1 |
composer require yoeunes/toastr |
ile ekliyoruz. config/app.phpyi açıyoruz. laravel 5.5üstü için gerek yokta olur da çalışmaz diye
1 2 3 4 5 |
'providers' => [ ... Yoeunes\Toastr\ToastrServiceProvider::class ... ]; |
config klasörü içine toastr.phpnin düşmesini istiyorsak aşağıdaki kodu yazıyoruz. bunu yazın bence çünkü buradan çıkan mesajların tasarımsal değişikliklerini yapıyoruz. bulunsun.
1 |
php artisan vendor:publish --provider='Yoeunes\Toastr\ToastrServiceProvider' --tag="config" |
view dosyamıza toastr css ve jsyi eklememiz gerekli. bu da basit.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<!doctype html> <html> <head> <title>Toastr.js</title> @toastr_css </head> <body> </body> @toastr_js @toastr_render </html> |
kullanımı ise çok basit. controller’da işlemi bitirdik redirect yaptık. yapmadan önceki koda aşağıdakilerden birini yaz yolla. otomatik çıkacak.
1 2 3 4 5 6 7 8 9 10 11 |
toastr()->warning('My name is Inigo Montoya. You killed my father, prepare to die!') // Set a success toast, with a title toastr()->success('Have fun storming the castle!', 'Miracle Max Says') // Set an error toast, with a title toastr()->error('I do not think that word means what you think it means.', 'Inconceivable!') // Override global config options from 'config/toastr.php' toastr()->success('We do have the Kapua suite available.', 'Turtle Bay Resort', ['timeOut' => 5000]) |
ayrıntılı bilgi https://github.com/yoeunes/toastr