1. Go to this page and download the library: Download mujhtech/nav-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/ */
// Display an info toast with no title
navtoastr()->info('Are you the 6 fingered man?')
namespace App\Http\Controllers;
use App\User;
use App\Http\Requests\PostRequest;
use Illuminate\Database\Eloquent\Model;
class UserController extends Controller
{
public function store(UserRequest $request)
{
$post = User::create($request->only(['username', 'password']));
if ($post instanceof Model) {
navtoastr()->success('Data has been saved successfully!');
return navtoastr()->named('posts.index');
}
navtoastr()->error('An error has occurred please try again later.');
return navtoastr()->back();
}
}
// Set a info toast
navtoastr()->info('My name is Muhideen Mujeeb')
// Set a success toast
navtoastr()->success('Have fun storming the castle!')
// Set an error toast
navtoastr()->error('I do not think that word means what you think it means.')
// Set an warning toast
navtoastr()->warning('We do have the Kapua suite available.')
navtoastr()->info('Are you the 6 fingered man?')->success('Have fun storming the castle!')->warning('doritos');
navtoastr()->render() or app('nav-toastr')->render()