Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-flashy maintained by sakanjo

Description
Easy flash notifications for laravel
Author
Last update
2023/08/27 22:54 (dev-master)
License
Links
Downloads
45
Tags

Comments
comments powered by Disqus

Flashy

A powerful package for creating flash messages in Laravel.

License Latest Stable Version Total Downloads GitHub Repo stars

Installation

Require this package with composer using the following command

composer require sakanjo/laravel-flashy

Next publish the config file using the vendor:publish Artisan command

php artisan vendor:publish --provider="Flashy\ServiceProvider"

Usage

public function store(Request $request) {
  User::create([
    'name' => 'Salah Kanjo',
    'email' => 'dev.salah.kanjo@gmail.com'
  ]);
  Success('Successfully created');
}
public function edit(Request $request) {
  Error_if(!auth()->user()->verified(), "Please verify your account first");

  ...
}

Or even a custom flash

Flash('info', 'Account requires verification', ['url' => 'http://example.org']);

Why

Imagine the next senario where you have a function inside another function and you want to return an error from the inner one all the way up

public function getData() {
  $user = Http::get('http://example.com/users/' . auth()->id);
  Error_if($user->failed(), 'Something went wrong');
  return $user;
}
public function index() {
  $data = getData(); // Stops execution here if user not found

  return inertia('Home', compact('data'))
}

Support

Do you like this project? Support it by donating

Maintainers

Laravel flashy is developed and maintained by Salah Kanjo

License

Laravel flashy is open-sourced software licensed under the MIT license