PHP code example of devrabiul / laravel-toaster-magic
1. Go to this page and download the library: Download devrabiul/laravel-toaster-magic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devrabiul / laravel-toaster-magic example snippets
{!! ToastMagic::styles() !!}
{!! ToastMagic::scripts() !!}
use Devrabiul\ToastMagic\Facades\ToastMagic;
public function store()
{
// Your logic
ToastMagic::success('Successfully Created');
// Another Way - message and description
ToastMagic::success("Success!", "Your data has been saved!");
// Another Way - message and description
ToastMagic::success("Success!", "Your data has been saved!", [
'showCloseBtn' => true,
'customBtnText' => 'Link Text',
'customBtnLink' => 'https:/demo.com',
]);
return back();
}
$this->dispatch('toastMagic',
status: 'success',
title: 'User Created',
message: 'The user has been successfully created.',
options: [
'showCloseBtn' => true,
'customBtnText' => 'Link Text',
'customBtnLink' => 'https:/demo.com',
],
);
$this->dispatch('toastMagic',
status: 'info',
title: 'User Created 2',
message: 'The user has been successfully created.'
);