PHP code example of ab01faz101 / tail-alert

1. Go to this page and download the library: Download ab01faz101/tail-alert 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/ */

    

ab01faz101 / tail-alert example snippets


<script src="{{ asset('vendor/tail_alert/alert.js') }}"></script>

@

use Ab01faz101\TailAlert\Traits\TailAlertTrait;
 
class Index extends Component
{
    use TailAlertTrait;
    
    public function submit()
    {
        $this->alert('success', 'Basic Alert');
    }
}

$this->alert('success', 'alert message'  , "description");
$this->alert('info', 'alert message'  , "description");
$this->alert('warning', 'alert message' , "description");
$this->alert('error', 'alert message'  , "description");

public function flashSuccess() {
    session()->flash('alert', [
        'type' => 'success',
        'message' => 'Successful Operation!'
    ]);
}

public function flashError() {
    session()->flash('alert', [
        'type' => 'error',
        'message' => 'An Error Occurred.'
    ]);
}

public function flashWarning() {
    session()->flash('alert', [
        'type' => 'warning',
        'message' => 'Warning.'
    ]);
}

public function flashInfo() {
    session()->flash('alert', [
        'type' => 'info',
        'message' => 'Information.'
    ]);
}

public function redirectAlert() {
    return redirect()->route('test')->with('alert' , [
        'type' => 'success',
        'message' => 'mission successfully!'
    ]);
}
sh
 php artisan vendor:publish --provider="Ab01faz101\TailAlert\TailAlertServiceProvider" --force