1. Go to this page and download the library: Download afrizalmy/laratoast-jquery 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
laratoast()->info("Are you married?","Information","bottom-right");
namespace App\Http\Controllers;
use App\Post;
use App\Http\Requests\PostRequest;
use Illuminate\Database\Eloquent\Model;
class PostController extends Controller
{
public function store(PostRequest $request)
{
$post = Post::create($request->only(['title', 'body']));
if ($post instanceof Model) {
laratoast()->success("Data has been saved successfully!","Success","bottom-right",['textAlign'=>'left']);
return redirect()->route('posts.index');
}
laratoast()->error("An error has occurred please try again later.","Error!","bottom-center");
return back();
}
}