New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

grantholle/reaction

Get a reaction in Laravel 5
10 1
Install
composer require grantholle/reaction
Latest Version:1.2
PHP:>=5.4.0
Laravel:5
License:MIT
Last Updated:Jul 15, 2017
Links: GitHub  ·  Packagist
Maintainer: grantholle

Reaction

Generates a reaction based on a type of event (positive, bad, unsafe)

Installation

Include this package via Composer...

composer require grantholle/reaction

Add the service provider in config/app.php...

'providers' => [
  ...
  Some\Kind\Of\ReactionServiceProvider::class
  ...
];

Usage

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();

...

Related Packages

laragear/meta

A Laravel Package helper for Laravel Packages

1,407,075 7
cleaniquecoders/laravel-helper

Built with Laravel Standalone Package Creator

10,397 4
ipunkt/laravel-package-manager

Package Manager for laravel packages

1,745 2
wi-development/media

Admin's media

50 0
wi-development/sitemap

wi sitemap packaage

49 0

Version History

Version Released PHP Laravel License
1.2 >=5.4.0 ^5 MIT
1.1 >=5.4.0 ^5 MIT
1.0 >=5.4.0 ^5 MIT