laravel-learn-bbs/app/Providers/AuthServiceProvider.php

38 lines
908 B
PHP
Raw Permalink Normal View History

2017-12-24 14:17:18 +00:00
<?php
namespace App\Providers;
use App\Models\User;
use App\Policies\UserPolicy;
2017-12-24 14:17:18 +00:00
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
2018-02-12 13:39:52 +00:00
use Laravel\Horizon\Horizon;
2017-12-24 14:17:18 +00:00
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
2018-01-15 15:24:11 +00:00
\App\Models\Reply::class => \App\Policies\ReplyPolicy::class,
2018-01-01 04:00:45 +00:00
\App\Models\Topic::class => \App\Policies\TopicPolicy::class,
2017-12-24 14:17:18 +00:00
'App\Model' => 'App\Policies\ModelPolicy',
User::class => UserPolicy::class,
2017-12-24 14:17:18 +00:00
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
2018-02-12 13:39:52 +00:00
Horizon::auth(function ($request) {
return \Auth::user()->hasRole('Founder');
});
2017-12-24 14:17:18 +00:00
//
}
}