PHP code example of rexlmanu / laravel-toast

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

    

rexlmanu / laravel-toast example snippets


  // config/app.php
  'providers' => array(
    // ...
    'Grimthorr\LaravelToast\ServiceProvider',
  ),
  // ...
  'aliases' => array(
    // ...
    'Toast' => 'Grimthorr\LaravelToast\Facade',
  ),
  

return array(
  'levels' => array(
    'info' => 'info',
    'success' => 'success',
    'error' => 'error',
    'warning' => 'warning',
    'default' => 'info'
  ),
);

Toast::message('message', 'level', 'title');
toast()->message('message', 'level', 'title');
toast('message', 'title');

Toast::info('message', 'title');
toast()->info('message', 'title');

Toast::success('message', 'title');
toast()->success('message', 'title');

Toast::error('message', 'title');
toast()->error('message', 'title');

Toast::warning('message', 'title');
toast()->warning('message', 'title');

Toast::clear();
toast()->clear();

// Create the message
Toast::error('oops');

// Return a HTTP response to initiate the new session
return Redirect::to('home');

// Create the message
Toast::error('oops')
  ->info('hello');

// Return a HTTP response to initiate the new session
return Redirect::to('home');

// Create the message
toast('example', 'title goes here');

// Return a HTTP response to initiate the new session
return Redirect::to('home');

// Create the message
toast()->message('example', 'help');

// Return a HTTP response to initiate the new session
return Redirect::to('home');