πŸͺHooks

he resource class has a lot of hooks to handle the data on every method.

Index Hooks

public function beforeIndex(Request $request): Request
{
    return $request;
}
public function beforeIndexQuery($query, Request $request, array $rows): void {}
public function beforeIndexQueryAPI($query, Request $request,array $rows): void {}
public function afterIndexQuery($query, Request $request, array $rows): void {}
public function afterIndexQueryAPI($query, Request $request, array $rows): void {}
public function beforeIndexAPI(Request $request): Request 
{
   return $request;
}
public function afterIndex(LengthAwarePaginator $data,Request $request): void {}
public function afterIndexAPI(LengthAwarePaginator $data,Request $request): void {}

Store Hooks

public function beforeStore(Request $request): Request
{
   return $request;
}

Show Hooks

Update Hooks

Destroy Hooks

Bulk Hooks

Export Hooks

Import Hooks

Last updated