2018-11-15 10:45:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2024-06-09 23:18:59 +00:00
|
|
|
use Illuminate\Http\Request;
|
2021-11-26 13:36:57 +00:00
|
|
|
use Illuminate\Notifications\ChannelManager;
|
2024-06-09 23:18:59 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2021-11-26 13:36:57 +00:00
|
|
|
use Illuminate\Support\Facades\Notification;
|
2018-11-15 10:45:49 +00:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
2023-07-23 07:27:52 +00:00
|
|
|
use App\Notifications\Channels\{EchomailChannel,NetmailChannel};
|
|
|
|
use App\Models\{Echomail,Netmail};
|
2021-07-16 06:55:26 +00:00
|
|
|
use App\Traits\SingleOrFail;
|
|
|
|
|
2018-11-15 10:45:49 +00:00
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
2021-07-16 06:55:26 +00:00
|
|
|
use SingleOrFail;
|
|
|
|
|
2021-05-22 14:38:19 +00:00
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2021-11-26 13:36:57 +00:00
|
|
|
Notification::resolved(function (ChannelManager $service) {
|
2023-07-23 07:27:52 +00:00
|
|
|
$service->extend('echomail', function ($app) {
|
|
|
|
return new EchomailChannel($app->make(Echomail::class));
|
|
|
|
});
|
|
|
|
|
2021-11-26 13:36:57 +00:00
|
|
|
$service->extend('netmail', function ($app) {
|
|
|
|
return new NetmailChannel($app->make(Netmail::class));
|
|
|
|
});
|
|
|
|
});
|
2021-05-22 14:38:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2021-07-16 06:55:26 +00:00
|
|
|
static::bootSingleOrFail();
|
2024-06-09 23:18:59 +00:00
|
|
|
|
|
|
|
Auth::viaRequest('matrix-token',function (Request $request) {
|
|
|
|
return (config('matrix.hs_token') && ($request->bearerToken() === config('matrix.hs_token'))) ? TRUE : NULL;
|
|
|
|
});
|
2021-05-22 14:38:19 +00:00
|
|
|
}
|
2018-11-15 10:45:49 +00:00
|
|
|
}
|