TraceDash/app/Providers/AuthServiceProvider.php

32 lines
727 B
PHP
Raw Permalink Normal View History

2023-11-23 19:27:43 +01:00
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
2023-11-23 19:27:43 +01:00
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use App\Models\User;
use App\Models\Trace\Channel as TraceChannel;
2023-11-23 19:27:43 +01:00
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
//
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
Gate::define('access-channel', function(User $user, TraceChannel $channel) {
return $user->hasChannelPermission($channel);
});
2023-11-23 19:27:43 +01:00
}
}