nilede-bharat / easy-toast
Easy backend make toast notification for laravel+vue
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Language:Vue
Requires
- php: *
- laravel/framework: *
Requires (Dev)
This package is not auto-updated.
Last update: 2025-08-21 13:48:07 UTC
README
This package provide integration easily show notification
Installation
You can easily install this library using Composer. Just request the package with the following command:
composer require nilede-bharat/easy-toast
if getting any error install this package using composer:
composer require nilede-bharat/easy-toast --ignore-platform-reqs
Configuration
1.publish ToastNotification Component file
php artisan vendor:publish --tag=Bharat\EasyToast\EasyToastServiceProvider
2.Register notification in HandleInertiaRequests App\Http\Middleware\HandleInertiaRequests
<?php namespace App\Http\Middleware; use App\Traits\ToastNotificationTrait; use Illuminate\Http\Request; use Inertia\Middleware; class HandleInertiaRequests extends Middleware { use ToastNotificationTrait; public function share(Request $request) { return array_merge(parent::share($request), [ ...$this->init(), ]); } }
3.Register notification in base controller App\Http\Controllers\Controller its optional
<?php namespace App\Http\Controllers; use App\Traits\ToastNotificationTrait; use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { use ToastNotificationTrait; }
4.import Toast Notification component in main layout
<template> <div> <ToastNotification/> <main> <slot/> </main> </div> </template> <script setup> import ToastNotification from "@/Components/ToastNotification.vue"; </script>
Usage
Create notification in any controller
<?php namespace App\Http\Controllers; class AdmissionController extends Controller { public function store() { // this code available when // 3.Register notification in base controller App\Http\Controllers\Controller its optional $this->success('message'); $this->error('message'); $this->warning('message'); // OR return redirect()->back()->with('success','message'); // OR return redirect()->back()->with('error','message'); // OR return redirect()->back()->with('message','message'); } }