Package Data | |
---|---|
Maintainer Username: | grantholle |
Package Create Date: | 2017-07-14 |
Package Last Update: | 2017-07-15 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-24 15:06:53 |
Package Statistics | |
---|---|
Total Downloads: | 10 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Generates a reaction based on a type of event (positive, bad, unsafe)
Include this package via Composer...
composer require grantholle/reaction
Add the service provider in config/app.php
...
'providers' => [
...
Some\Kind\Of\ReactionServiceProvider::class
...
];
Simply use the react()
helper function to generate a random reaction. I like to pair it with Laracast's Flash package for easy, fun flash messaging.
react('positive'); // <strong>Boom!</strong>
react('bad'); // <strong>Yikes!</strong>
react('unsafe'); // <strong>Heads up!</strong>
// Using chaining
react()->positive(); // <strong>Great!</strong>
react()->bad(); // <strong>Darn!</strong>
react()->unsafe(); // <strong>Easy!</strong>
// Don't wrap it in <strong/>
react('positive', false);
react(null, false)->positive();
💯
// A controller function, for example
public function update(Request $request, Model $model)
{
$model->update($request->all());
$message = react()->positive() . ' The model has been updated successfully.';
// <strong>Super!</strong> The model has been updated successfully.
flash($message)->success();
...