项目作者: idemonbd

项目描述 :
Flexible Toastr JS Alert System for PHP/Laravel.
高级语言: PHP
项目地址: git://github.com/idemonbd/notify.git
创建时间: 2021-06-05T14:43:58Z
项目社区:https://github.com/idemonbd/notify

开源协议:

下载


Toastr JS Alert Notification System for PHP/Laravel

1. Install

  1. composer require plusemon/notify

2. Add resources

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Laravel Notify</title>
  7. <link rel="stylesheet" href="https://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css" />
  8. </head>
  9. <body>
  10. <!-- Main Contents -->
  11. <h1>Laravel Toastr Notify Notification</h1>
  12. <!-- jQuery CDN -->
  13. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  14. <!-- Toastr script CDN -->
  15. <script src="https://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script>
  16. <!-- Toastr Scripts render -->
  17. {!! Notify::message() !!}
  18. </body>
  19. </html>

3. Usage

  1. <!-- Example -->
  2. Notify::success('You have successfully added Notify alert system');
  3. notify()->info('Info message with helper function');
  4. <!-- Using Facade -->
  5. Notify::info('message', 'title', ['options']);
  6. Notify::success('message', 'title', ['options']);
  7. Notify::warning('message', 'title', ['options']);
  8. Notify::error('message', 'title', ['options']);
  9. <!-- Clear -->
  10. Notify::clear();

return Notify::info(‘Info redirect back with message by helper function’)->back();
return notify()->info(‘Info redirect with message by helper function’)->redirect(‘/‘);

You have successfully installed notify system. 😃

Configuration

Add the service provider to config/app.php

  1. Plusemon\Notify\NotifyServiceProvider::class,

Optionally include the Facade in config/app.php if you’d like.

  1. 'Notify' => Plusemon\Notify\Facades\Notify::class,

Options

Publish the config file

  1. php artisan vendor:publish --provider=Plusemon\Notify\NotifyServiceProvider

For More visit toastr’s documentation to custom your need.

Dependencies

jQuery toast, you need to add css and js to your html.

MIT