Support the ongoing development of Laravel.io →
Authentication Authorization Architecture
Last updated 2 years ago.
0
moderator

Hello @ajax30

Did you place the dd(session('userPermissions')) in your gate function or outside?

Gate::define('view-users', function() {
  // like here
  return in_array('view-users', session('userPermissions'));
});

If it is outside I understand that the session is empty because it is loaded before the session data is loaded. Else I suspect that it should be filled.

ajax30 liked this reply

1
Solution

@tvbeek There is a good answer here. Check it out.

0
Solution selected by @driesvints

Sign in to participate in this thread!

Eventy

Your banner here too?

Razvan ajax30 Joined 2 Oct 2021

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.