tonning / flashable
A simple trait to flash when model events are fired, like `created`, `updated`, and `saved`.
Installs: 6 560
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=5.6.4
- laracasts/flash: ^3.0
This package is auto-updated.
Last update: 2024-10-29 04:53:22 UTC
README
A simple trait to flash when model events are fired, like created
, updated
, and saved
.
Using Jeffrey Way's excellent Flash package to actually display the flash messages.
Installation
Begin by pulling in the package through Composer.
composer require tonning/flashable
Then add the trait to the model you want to automatically flash on crud actions.
use Tonning\Flashable\Flashable; class Post extends Model { use Flashable; ... }
Customization
You can specify the name of the model by adding a getModelName
method on you model.
public function getModelName() { return 'Blog post'; }
For even more fine grain control you can add a protected property on the model.
protected $flashable = [ 'created' => 'Your blog post have been created. Good job!', 'updated' => 'I hope nobody saw those mistakes...', 'deleted' => 'Be gone blog post!' ]