-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Emeka Mbah edited this page Jun 28, 2023
·
14 revisions
Alert is a Laravel package for displaying different types of messages in Laravel application views. It's designed to make flashing messages in Laravel Applications a breeze, with a lot of easy-to-use and fluent methods.
The alert is pretty easy to use, customize and extend. There are 6 out-of-box alert types, fortunately, you can easily create custom types.
Alert::message('Welcome! Please complete your profile')
->info()
->flash();
Alert::sticky('Your subscription has expired and we are unable to charge your credit card')
->title('Billing')
->action('Yes', '/')
->tag('contact')
->warning()
->flash();
Then much later from anywhere
Alert::stickForget('contact')
Alert::field('Username looks good')
->name('username')
->tag('login')
->success()
->flash();
Alert::field('Password looks bad')
->name('password')
->tag('login')
->error()
->flash();
$validator = validator(
[
'username' => '',
'password' => 'pass'
],
[
'username' => 'required',
'password' => 'required|min:6'
]
);
Alert::fieldBag($validator)
->error()
->flash();
Alert::modal('Your message has been received, you will hear from us soon')
->title('Thanks!')
->action('Yes')
->cancel('Cancel')
->centered()
->large()
->success()
->flash();
Alert::notify('Some errors occurred!')
->title('Opps!')
->bottomRight()
->tag('contact')
->error()
->flash();