PHP code example of williamcruzme / laravel-notification-settings

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

    

williamcruzme / laravel-notification-settings example snippets




namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Millions\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;
}

/**
 * Run the database seeds.
 *
 * @return void
 */
public function run()
{
    DB::table('notification_types')->insert([
        'name' => 'App\\Notifications\\Welcome',
        'display_text' => 'Welcome message',
        'status' => true,
    ]);
}

Notification::routes();

use App\Notifications\InvoicePaid;

$user->notify(new InvoicePaid($invoice));

use Millions\Notifications\Facades\Notification;

Notification::send($users, new InvoicePaid($invoice));

Notification::routesForSettings('App\Http\Controllers');



namespace App\Http\Controllers;

use Millions\Notifications\ManageNotificationSettings;

class NotificationSettingController extends Controller {

    use ManageNotificationSettings;
    
    /**
     * Get the notification settings validation rules.
     *
     * @return array
     */
    protected function rules()
    {
        return [
            'status' => ['



namespace App\Http\Controllers;

use Millions\Notifications\ManageNotificationSettings;

class NotificationSettingController extends Controller {

    use ManageNotificationSettings;
    
    /**
     * Get the response for a successful listing notification settings.
     *
     * @param  array  $response
     * @return \Illuminate\Http\JsonResponse
     */
    protected function sendResponse($response)
    {
        return response()->json($response);
    }
}



namespace App\Http\Controllers;

use Millions\Notifications\ManageNotificationSettings;

class NotificationSettingController extends Controller {

    use ManageNotificationSettings;
    
    /**
     * Get the guard to be used during notifications management.
     *
     * @return \Illuminate\Contracts\Auth\StatefulGuard
     */
    protected function guard()
    {
        return auth('admin')->guard();
    }
}
bash
php artisan migrate
bash
php artisan vendor:publish --tag=migrations
bash
php artisan make:seeder NotificationTypesTableSeeder