@@ -90,8 +90,8 @@ class PostsController extends JsonApiController
9090
9191### Resource Hooks
9292
93- The controller allows you to hook into the resource lifecycle by invoking the following methods if they are
94- implemented. These methods allow you to easily implement application specific actions, such as firing events
93+ The controller allows you to hook into the resource lifecycle by invoking the following methods if they are
94+ implemented. These methods allow you to easily implement application specific actions, such as firing events
9595or dispatching jobs.
9696
9797| Hook | Arguments | Request Class |
@@ -106,12 +106,12 @@ or dispatching jobs.
106106| ` created ` | record, request | ` CreateResource ` |
107107| ` saved ` | record, request | ` CreateResource ` or ` UpdateResource ` |
108108| ` deleting ` | record, request | ` DeleteResource ` |
109- | ` deleted ` | record, request | ` DeleteResource ` |
109+ | ` deleted ` | record, request | ` DeleteResource ` |
110110
111111> The request class is the validated request in the ` CloudCreativity\LaravelJsonApi\Http\Requests ` namespace.
112112
113113The ` searching ` , ` searched ` , ` reading ` and ` didRead ` hooks are invoked when resource(s) are being accessed,
114- i.e. a ` GET ` request. The ` searching ` and ` searched ` hooks are invoked when reading any resources
114+ i.e. a ` GET ` request. The ` searching ` and ` searched ` hooks are invoked when reading any resources
115115(the * index* action), while ` reading ` and ` didRead ` are invoked when reading a specific record
116116(the * read* action).
117117
@@ -158,7 +158,7 @@ if reading the `author` relationship on a `posts` resource, the `readingRelation
158158methods will be invoked if they exist.
159159
160160The ` reading... ` and ` didRead... ` methods are invoked when accessing the related resource or the relationship data,
161- i.e. a ` GET ` relationship request. The ` replacing... ` and ` replaced... ` methods are invoked when changing the
161+ i.e. a ` GET ` relationship request. The ` replacing... ` and ` replaced... ` methods are invoked when changing the
162162entire relationship in a ` PATCH ` relationship request.
163163
164164For * to-many* relationships, the ` adding... ` and ` added... ` methods are invoked when adding resources to the
@@ -184,7 +184,7 @@ For example, if we wanted to send a `202 Accepted` response when a resource was
184184protected function deleted($record)
185185{
186186 return $this->reply()->meta([
187- 'accepted-at ' => Carbon\Carbon::now()->toW3cString()
187+ 'acceptedAt ' => Carbon\Carbon::now(),
188188 ], 202);
189189}
190190```
@@ -197,7 +197,7 @@ Content-Type: application/vnd.api+json
197197
198198{
199199 "meta": {
200- "accepted-at ": "2018-04-10T11:56:52+00:00"
200+ "acceptedAt ": "2018-04-10T11:56:52+00:00"
201201 }
202202}
203203```
@@ -224,11 +224,11 @@ use CloudCreativity\LaravelJsonApi\Http\Controllers\JsonApiController;
224224
225225class PostsController extends JsonApiController
226226{
227-
227+
228228 public function share(\App\Post $post): \Illuminate\Http\Response
229229 {
230230 \App\Jobs\SharePost::dispatch($post);
231-
231+
232232 return $this->reply()->content($post);
233233 }
234234}
@@ -257,11 +257,11 @@ use CloudCreativity\LaravelJsonApi\Http\Requests\FetchResource;
257257
258258class PostsController extends JsonApiController
259259{
260-
260+
261261 public function share(FetchResource $request, \App\Post $post): \Illuminate\Http\Response
262262 {
263263 \App\Jobs\SharePost::dispatch($post);
264-
264+
265265 return $this->reply()->content($post);
266266 }
267267}
0 commit comments