clrghouz/app/Providers/AppServiceProvider.php

51 lines
1.1 KiB
PHP

<?php
namespace App\Providers;
use Illuminate\Http\Request;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\ServiceProvider;
use App\Notifications\Channels\{EchomailChannel,NetmailChannel};
use App\Models\{Echomail,Netmail};
use App\Traits\SingleOrFail;
class AppServiceProvider extends ServiceProvider
{
use SingleOrFail;
/**
* Register any application services.
*
* @return void
*/
public function register()
{
Notification::resolved(function (ChannelManager $service) {
$service->extend('echomail', function ($app) {
return new EchomailChannel($app->make(Echomail::class));
});
$service->extend('netmail', function ($app) {
return new NetmailChannel($app->make(Netmail::class));
});
});
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
static::bootSingleOrFail();
Auth::viaRequest('matrix-token',function (Request $request) {
return (config('matrix.hs_token') && ($request->bearerToken() === config('matrix.hs_token'))) ? TRUE : NULL;
});
}
}