sakanjo/laravel-flashy
最新稳定版本:1.1.2
Composer 安装命令:
composer require sakanjo/laravel-flashy
包简介
Easy flash notifications for laravel
README 文档
README
A powerful package for creating flash messages in Laravel.
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
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-12