2017-11-03 05:26:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2018-06-05 11:13:57 +00:00
|
|
|
use Laravel\Passport\Passport;
|
2017-11-03 05:26:07 +00:00
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
|
|
|
|
|
|
class AuthServiceProvider extends ServiceProvider
|
|
|
|
{
|
2020-02-18 11:35:20 +00:00
|
|
|
/**
|
|
|
|
* The policy mappings for the application.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $policies = [
|
|
|
|
'App\Model' => 'App\Policies\ModelPolicy',
|
|
|
|
];
|
2017-11-03 05:26:07 +00:00
|
|
|
|
2020-02-18 11:35:20 +00:00
|
|
|
/**
|
|
|
|
* Register any authentication / authorization services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
$this->registerPolicies();
|
|
|
|
Passport::routes();
|
|
|
|
// Passport::enableImplicitGrant();
|
|
|
|
|
|
|
|
Gate::define('wholesaler', function ($user) {
|
|
|
|
return $user->isWholesaler();
|
|
|
|
});
|
2021-07-13 02:31:56 +00:00
|
|
|
|
|
|
|
Gate::define('reseller', function ($user) {
|
|
|
|
return $user->isReseller();
|
|
|
|
});
|
2020-02-18 11:35:20 +00:00
|
|
|
}
|
|
|
|
}
|