PHP code example of yoeunes / toastr
1. Go to this page and download the library: Download yoeunes/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/ */
yoeunes / toastr example snippets
// Display a success toast with no title
flash()->success('Operation completed successfully.');
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) {
toastr()->success('Data has been saved successfully!');
return redirect()->route('posts.index');
}
toastr()->error('An error has occurred please try again later.');
return back();
}
}
bash
php artisan flasher:install