32 lines
727 B
PHP
32 lines
727 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
|
|
use App\Models\User;
|
|
use App\Models\Trace\Channel as TraceChannel;
|
|
|
|
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);
|
|
});
|
|
}
|
|
}
|