Skip to content

Commit

Permalink
horizon gate
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Jan 10, 2025
1 parent db079c0 commit 925af53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Providers/HorizonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use App\Contracts\CustomJobRepositoryInterface;
use App\Models\ApplicationDeploymentQueue;
use App\Models\User;
use App\Repositories\CustomJobRepository;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\Events\JobReserved;
Expand Down Expand Up @@ -42,6 +44,16 @@ public function boot(): void
]);
}
});
}

protected function gate(): void
{
Gate::define('viewHorizon', function ($user) {
$root_user = User::find(0);

return in_array($user->email, [
$root_user->email,
]);
});
}
}

0 comments on commit 925af53

Please sign in to comment.