From e32a8ff4a57f93f2fd053b899d47636ec9f5a036 Mon Sep 17 00:00:00 2001 From: Silver Zachara Date: Wed, 30 Nov 2016 21:06:59 +0100 Subject: [PATCH 1/3] Fixed code example in README.MD --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3510264..2e4c559 100644 --- a/README.md +++ b/README.md @@ -334,6 +334,16 @@ class EmployeesTransformer implements JsonApiMapping { return []; } + + /** + * Returns an array of properties that are mandatory to be passed in when doing create or update. + * + * @return array + */ + public function getRequiredProperties() + { + return []; + } } ``` @@ -516,8 +526,10 @@ Let's create a new controller that extends the `JsonApiController` provided by t **Lumen users must extends from `LumenJsonApiController` not `JsonApiController`**. +**Employees Controller** + ```php - Date: Wed, 30 Nov 2016 21:34:40 +0100 Subject: [PATCH 2/3] Added route for Orders resource --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2e4c559..bfa5e3a 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ This is how our `app/Http/routes.php` will look: 'Api'], function() { Route::resource('employees', 'EmployeesController'); + Route::resource('orders', 'OrdersController'); Route::get( 'employees/{employee_id}/orders', [ 'as' => 'employees.orders', From 742199ce456ad0cfeaad692ad6b702e51cf6f7c8 Mon Sep 17 00:00:00 2001 From: Silver Zachara Date: Wed, 30 Nov 2016 22:52:48 +0100 Subject: [PATCH 3/3] Added missing namespaces in EmployeesController --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bfa5e3a..197fc93 100644 --- a/README.md +++ b/README.md @@ -610,6 +610,9 @@ If you look inside the `listAction`you'll find a code similar to the one below, use App\Model\Database\Employees; use App\Model\Database\Orders; +use Illuminate\Http\Request; +use NilPortugues\Api\JsonApi\Http\Factory\RequestFactory; +use NilPortugues\Laravel5\JsonApi\Actions\ListResource; use NilPortugues\Laravel5\JsonApi\Controller\JsonApiController; class EmployeesController extends JsonApiController