-
Notifications
You must be signed in to change notification settings - Fork 52
/
AuthServiceProvider.php
40 lines (36 loc) · 1.46 KB
/
AuthServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Models\Client' => 'App\Policies\ClientPolicy',
'App\Models\Finance\Invoice' => 'App\Policies\Finance\InvoicePolicy',
'App\Models\Project' => 'App\Policies\ProjectPolicy',
'App\Models\KnowledgeCafe\WeeklyDose' => 'App\Policies\KnowledgeCafe\WeeklyDosePolicy',
'App\Models\KnowledgeCafe\Library\Book' => 'App\Policies\KnowledgeCafe\Library\BookPolicy',
'App\Models\KnowledgeCafe\Library\BookCategory' => 'App\Policies\KnowledgeCafe\Library\BookCategoryPolicy',
'App\Models\Setting' => 'App\Policies\SettingPolicy',
'App\Http\Controllers\Finance\ReportsController' => 'App\Policies\Finance\ReportPolicy',
'App\Http\Controllers\UserController' => 'App\Policies\UserPolicy',
'Modules\Infrastructure\Http\Controllers\InfrastructureController' =>'App\Policies\Infrastructure\BillingsPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Gate::before(function ($user) {
return $user->hasRole('super-admin') ? true : null;
});
}
}