itsnubix / toast
Installs: 23
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
pkg:composer/itsnubix/toast
Requires
- php: ^8.0
- illuminate/support: ^8.0
- inertiajs/inertia-laravel: ^0.4.1
This package is not auto-updated.
Last update: 2025-10-18 13:34:06 UTC
README
Requirements
- PHP 8.0 and up
- Laravel 8 and up
Installation
Step 1. Install dev package with Composer
composer require itsnubix/toast php artisan nubix-toast:install
Step 2. Add follow lines to resources/js/app.js file.
- Add follow import to the top of the file
import toastPlugin from '@/Plugins/toast'
- Add following line after
.use(plugin)
.use(toastPlugin)
Step 3. Add following code to share() in HandleInertiaRequests.php
'toast' => fn () => $request->session()->get(config('toast.session_id')) ?? []
Final share function should look like this.
/** * Define the props that are shared by default. * * @param \Illuminate\Http\Request $request * @return array */ public function share(Request $request) { return array_merge(parent::share($request), [ 'auth' => [ 'user' => $request->user(), ], 'toast' => fn () => $request->session()->get(config('toast.session_id')) ?? [] ]); }
Step 4. Finish up installation
npm install && npm run dev