PHP code example of notifylog / laravel

1. Go to this page and download the library: Download notifylog/laravel 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/ */

    

notifylog / laravel example snippets




namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
use NotifyLog\Laravel\NotifyLog;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;



    function index(NotifyLog $notifyLog){


        $event = [
            "name" =>  "NotifyLog Laravel Plugin",
            "description" =>  "Hello world from Laravel",
            "channel" =>  "from-laravel",
            "icon" =>  "💸",
            "notify" =>  true,
            "tags" => [
                "my-tag" =>  "my-tag-value",
            ],
            "message" =>
                "[Link](https://google.com)",
        ];

       // Use:
       $notifyLog->publish($event);

       // or, you can also use the helper
       // without the need to inject
       // NotifyLog into the controller
       // by calling

       notifylog()->publish($event);

bash
php artisan notifylog:test