PHP code example of jcergolj / in-app-notifications-for-laravel

1. Go to this page and download the library: Download jcergolj/in-app-notifications-for-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/ */

    

jcergolj / in-app-notifications-for-laravel example snippets




namespace App\Http\Controllers;

use Jcergolj\InAppNotifications\Facades\InAppNotification;

class UserController extends Controller
{
    public function store(Request $request)
    {
        InAppNotification::success('User was successfully created.');

        return view('mailboxes.index');
    }
}



InAppNotification::success($message);

InAppNotification::error($message);

InAppNotification::warning($message);

InAppNotification::info($message);



public function register(): void
{
    $this->app->bind('in-app-notification', function () {
        return new Jcergolj\InAppNotifications\InAppNotification(10000); // 10 seconds
    });
}

// AppServiceProvider.php

InAppNotitication::macro('customMethod', function () {

});

// e.g. inside controller

InAppNotification::customMethod();


// add this for adding testable macro
InAppNotification::fake();

InAppNotification::assertSet()
InAppNotification::assertSet('Assert against this text.');

InAppNotification::assertSuccess()
InAppNotification::assertSuccess('Success');

InAppNotification::assertError();
InAppNotification::assertError('Error');

InAppNotification::assertInfo();
InAppNotification::assertInfo('Info');

InAppNotification::assertWarning();
InAppNotification::assertWarning('Warning');

InAppNotification::assertTimeout(10000);
bash
php artisan vendor:publish --provider="Jcergolj\InAppNotifications\InAppNotificationsServiceProvider"