Support the ongoing development of Laravel.io →
Authentication Authorization Architecture
Last updated 6 months 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.

1

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

0
Solution selected by @driesvints

Sign in to participate in this thread!

LoadForge

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?

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

© 2022 Laravel.io - All rights reserved.