<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use App\Http\Controllers\HomeController;
use App\Http\Controllers\ItemController;
Route::get('/', function () {
dd('Welcome to simple user route file.');
});
Auth::routes();
Route::get('/home', [HomeController::class, 'index'])->name('home');
Route::get('notification', [HomeController::class,'notification']);
<?php
namespace App\Http\Controllers;
use Session;
class HomeController extends Controller {
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() {
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index() {
return view('home');
}
public function notification() {
Session::put('success', "Item created successfully 1.");
return view('notification-check');
}
}
Laravel notification message popup using toastr js plugin
By Hardik Savani August 9, 2016 Category : Laravel BootstrapPlayUnmuteLoaded: 1.20%FullscreenIn this post, i would like show you how to add toastr js plugin notification popup in laravel 6, laravel 7, laravel 8 and laravel 9 from scratch. toastr plugin provide us success message notification, info message notification, warning message notification, error message notification that way we can add notification with good layout.
Laravel have also several package for notification but i use toastr js plugin, that provide nice layout and pretty interesting.
We require to add one time toastr jquery code for notification, then we can manage using session. In this example you can easily understand how to implement and use.
First we will add new route for testing toastr notification like as bellow:
At last we require to create notification.blade.php file for display toastr.js notification. this file we can include in our default file that way we don't require to write same code in all place.
So, first let's create notification.blade.php and put bellow code on that file.