PHP code example of artdarek / toastr

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

    

artdarek / toastr example snippets


'providers' => array(
	Artdarek\Toastr\Providers\ToastrServiceProvider::class,
),

'aliases' => [
    'Toastr'    => Artdarek\Toastr\Facades\Toastr::class,
],
 php
@
 php
@if(Session::has('toastr.alerts'))
    <div id="toastr">
    @foreach(Session::get('toastr.alerts') as $alert)

        <div class='alert alert-{{ $alert['type'] }} @if(array_get($alert,'params.important') == true) important @endif'>
            <button class="close" type="button" data-dismiss="alert" aria-hidden="true">&times;</button>

            @if( ! empty($alert['title']))
                <div><strong>{{ $alert['title'] }}</strong></div>                
            @endif

            {{ $alert['message'] }}

            @if(array_get($alert,'params.important')) (This alert is marked as important) @endif

        </div>

    @endforeach
    </div>
@endif

 php
public function login()
{
	Toastr::success('Welcom back!')->push();
    return Redirect::home();
}
 php
public function login()
{
	Toastr::success('Welcom back!')->push();
	Toastr::warning('You don\'t look too good today!')->push();

    return Redirect::home();
}