Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ganyicz authored Mar 22, 2021
1 parent e88ba48 commit 6acdad7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,32 @@ class User extends Resource
{
return [];
}

public static function beforeSave(Request $request, $model)
{
// Do something before the model is created or updated
}

public static function afterSave(Request $request, $model)
{
// Do something after the model is created or updated
}

public static function beforeCreate(Request $request, $model)
{
// Do something before the model is created
}

public static function afterCreate(Request $request, $model)
{
// Do something after the model is created
}

public static function beforeUpdate(Request $request, $model)
{
// Do something before the model is updated
}

public static function afterUpdate(Request $request, $model)
{
// Do something after the model is updated
Expand Down Expand Up @@ -58,14 +73,26 @@ TIP: Apply the trait on your base Resource class inside your Nova folder so that

## Available callbacks

`public static function beforeSave(Request $request, $model)`

Called both before creating and updating the resource

`public static function afterSave(Request $request, $model)`

Called both after creating and updating the resource

`public static function beforeCreate(Request $request, $model)`

Called before creating a new resource

`public static function afterCreate(Request $request, $model)`

Called after creating a new resource

`public static function beforeUpdate(Request $request, $model)`

Called before updating an existing resource

`public static function afterUpdate(Request $request, $model)`

Called after updating an existing resource
Expand Down

0 comments on commit 6acdad7

Please sign in to comment.