You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will apply the match for the `id = 1` and `filtetr` along with the match for the `repositories` payload you're sending.
172
+
This will apply the match for the `id = 1` and `filter` along with the match for the `repositories` payload you're sending.
173
+
174
+
### Modify query
175
+
176
+
Similar with the way we can modify the query applied to the repository, we can do the same by adding the `indexQuery` method on the action:
177
+
178
+
```php
179
+
class PublishPostAction extends Action
180
+
{
181
+
public static function indexQuery(RestifyRequest $request, $query)
182
+
{
183
+
$query->whereNotNull('published_at');
184
+
}
185
+
186
+
//...
187
+
}
188
+
```
173
189
174
190
## All
175
191
@@ -179,8 +195,6 @@ Sometimes you may need to apply an action for all models. For this you can send:
179
195
repositories: 'all'
180
196
```
181
197
182
-
## Chunk
183
-
184
198
Under the hood Restify will take by 200 chunks entries from the database and the handle method for these in a DB transaction. You are free to modify this default number of chunks:
185
199
186
200
```php
@@ -200,7 +214,6 @@ public function actions(RestifyRequest $request)
200
214
}
201
215
```
202
216
203
-
204
217
And available actions only for a specific repository id could be listed like:
205
218
206
219
```http request
@@ -277,3 +290,59 @@ class DisableProfileAction extends Action
277
290
//...
278
291
}
279
292
```
293
+
294
+
## Action Log
295
+
296
+
It is often useful to view a log of the actions that have been run against a model, or seeing when the model was updated, deleted or created (and by whom). Thankfully, Restify makes it a breeze to add an action log to a model by attaching the `Binaryk\LaravelRestify\Models\Concerns\HasActionLogs` trait to the repository's corresponding Eloquent model.
297
+
298
+
Having `HasActionLogs` trait attached to your model, all of the actions and CRUD operations will be logged into the database into the `action_logs` table.
299
+
300
+
You can display them by attaching to the repository related for example:
301
+
302
+
```php
303
+
// PostRepository.php
304
+
use Binaryk\LaravelRestify\Fields\MorphToMany;
305
+
use Binaryk\LaravelRestify\Repositories\ActionLogRepository;
Definitely you can use your own `ActionLogRepository` to represent the data returned, maybe you prefer to represent the user details or something else.
0 commit comments