Skip to content

Commit

Permalink
Merge pull request #1024 from SlovakNationalGallery/MG-108
Browse files Browse the repository at this point in the history
Use gate instead of user attribute
  • Loading branch information
rastislav-chynoransky authored Oct 17, 2024
2 parents fe9fc11 + 70d3725 commit b94077b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Middleware/ConfigureFrontendFromUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
use App\Facades\Frontend;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use Symfony\Component\HttpFoundation\Response;

class ConfigureFrontendFromUser
{
public function handle(Request $request, Closure $next): Response
{
$frontend = !$request->user()->can_administer
$frontend = Gate::denies('administer')
? FrontendEnum::from($request->user()->frontend)
: null;

Expand Down

0 comments on commit b94077b

Please sign in to comment.