Back

FilamentPHP developers, did you ever need to cancel an action based on a condition? 🤔

With the before callback, you can easily add custom logic to validate actions, cancel unsafe operations using $action->cancel(), and notify users with helpful feedback. 🤞

It’s a quick and efficient way to add more control to your app’s actions! 🫡

#FilamentPHP #Laravel #PHP
image

1

95

  • No matching results...
  • Searching...

/ 1000

Yes, you can use $action->halt() as well, but here are the key differences:

- halt() pauses the action in its current state, while cancel() completely cancels the action.
- Both halt() and cancel() offer the ability to roll back the transaction.

So, if you use halt(), the model will remain open in its current state. On the other hand, cancel() will close the model as well as cancel the action.

65