Support the ongoing development of →
Authentication Authorization Architecture
Last updated 1 year ago.

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.


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

Solution selected by @driesvints

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Razvan ajax30 Joined 2 Oct 2021


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.

© 2023 - All rights reserved.