PHP code example of juanrube / laravel-toast-magic-8
1. Go to this page and download the library: Download juanrube/laravel-toast-magic-8 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/ */
juanrube / laravel-toast-magic-8 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.'
);
return [
'options' => [
// other options...
'color_mode' => true, // Automatically apply colors based on toast type
],
'livewire_enabled' => false,
'livewire_version' => 'v3',
];
return [
'options' => [
// other options...
"gradient_enable" => true, // Only available for default and material themes
],
'livewire_enabled' => false,
'livewire_version' => 'v3',
];
use Devrabiul\ToastMagic\Facades\ToastMagic;
ToastMagic::success('Operation Successful');
ToastMagic::error('Something went wrong');
ToastMagic::dispatch()->success(
'User Created',
'The user has been successfully created.',
[
'showCloseBtn' => true,
'customBtnText' => 'View Profile',
'customBtnLink' => 'https://demo.com',
]
);