<?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));
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();
}
}