-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
141c47d
commit 7aa4043
Showing
9 changed files
with
242 additions
and
8 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/NilPortugues/Laravel5/JsonApi/Actions/CreateResource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 5/04/16 | ||
* Time: 0:17. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Actions; | ||
|
||
use Exception; | ||
use NilPortugues\Api\JsonApi\Server\Errors\ErrorBag; | ||
|
||
/** | ||
* Class CreateResource. | ||
*/ | ||
class CreateResource extends \NilPortugues\Api\JsonApi\Server\Actions\CreateResource | ||
{ | ||
/** | ||
* @param Exception $e | ||
* @param ErrorBag $errorBag | ||
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws Exception | ||
*/ | ||
public function getErrorResponse(Exception $e, ErrorBag $errorBag) | ||
{ | ||
if (env('APP_DEBUG')) { | ||
throw $e; | ||
} | ||
|
||
return parent::getErrorResponse($e, $errorBag); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/NilPortugues/Laravel5/JsonApi/Actions/DeleteResource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 5/04/16 | ||
* Time: 0:17. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Actions; | ||
|
||
/** | ||
* Class DeleteResource. | ||
*/ | ||
class DeleteResource extends \NilPortugues\Api\JsonApi\Server\Actions\DeleteResource | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 5/04/16 | ||
* Time: 0:17. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Actions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* Class GetResource. | ||
*/ | ||
class GetResource extends \NilPortugues\Api\JsonApi\Server\Actions\GetResource | ||
{ | ||
/** | ||
* @param Exception $e | ||
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws Exception | ||
*/ | ||
public function getErrorResponse(Exception $e) | ||
{ | ||
if (env('APP_DEBUG')) { | ||
throw $e; | ||
} | ||
|
||
return parent::getErrorResponse($e); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/NilPortugues/Laravel5/JsonApi/Actions/ListResource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 5/04/16 | ||
* Time: 0:15. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Actions; | ||
|
||
/** | ||
* Class ListResource. | ||
*/ | ||
class ListResource extends \NilPortugues\Api\JsonApi\Server\Actions\ListResource | ||
{ | ||
/** | ||
* @param \Exception $e | ||
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function getErrorResponse(\Exception $e) | ||
{ | ||
if (env('APP_DEBUG')) { | ||
throw $e; | ||
} | ||
|
||
return parent::getErrorResponse($e); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/NilPortugues/Laravel5/JsonApi/Actions/PatchResource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 5/04/16 | ||
* Time: 0:17. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Actions; | ||
|
||
/** | ||
* Class PatchResource. | ||
*/ | ||
class PatchResource extends \NilPortugues\Api\JsonApi\Server\Actions\PatchResource | ||
{ | ||
/** | ||
* @param \Exception $e | ||
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function getErrorResponse(\Exception $e) | ||
{ | ||
if (env('APP_DEBUG')) { | ||
throw $e; | ||
} | ||
|
||
return parent::getErrorResponse($e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 5/04/16 | ||
* Time: 0:17. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Actions; | ||
|
||
/** | ||
* Class PutResource. | ||
*/ | ||
class PutResource extends \NilPortugues\Api\JsonApi\Server\Actions\PutResource | ||
{ | ||
/** | ||
* @param \Exception $e | ||
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function getErrorResponse(\Exception $e) | ||
{ | ||
if (env('APP_DEBUG')) { | ||
throw $e; | ||
} | ||
|
||
return parent::getErrorResponse($e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/NilPortugues/Laravel5/JsonApi/Repository/EloquentRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <[email protected]> | ||
* Date: 11/02/16 | ||
* Time: 23:03. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Laravel5\JsonApi\Repository; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use NilPortugues\Foundation\Infrastructure\Model\Repository\Eloquent\EloquentRepository as Repository; | ||
|
||
/** | ||
* Class Repository. | ||
*/ | ||
class EloquentRepository extends Repository | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $modelClass; | ||
|
||
/** | ||
* EloquentRepository constructor. | ||
* | ||
* @param Model $model | ||
*/ | ||
public function __construct(Model $model) | ||
{ | ||
$this->modelClass = get_class($model); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function modelClassName() | ||
{ | ||
return $this->modelClass; | ||
} | ||
} |