ClientPolicy::class, Product::class => ProductPolicy::class, Invoice::class => InvoicePolicy::class, Payment::class => PaymentPolicy::class, RecurringInvoice::class => RecurringInvoicePolicy::class, RecurringQuote::class => RecurringQuotePolicy::class, Quote::class => QuotePolicy::class, User::class => UserPolicy::class, ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); Auth::provider('users', function ($app, array $config) { return new MultiDatabaseUserProvider($this->app['hash'], $config['model']); }); Auth::provider('contacts', function ($app, array $config) { return new MultiDatabaseUserProvider($this->app['hash'], $config['model']); }); Gate::define('view-list', function ($user, $entity) { $entity = strtolower(class_basename($entity)); return $user->hasPermission('view_' . $entity) || $user->isAdmin(); }); } }