caster
4 months ago
372
2
Laravel

Controller and compact

Posted 4 months ago by caster

Is there a way to pass the same variable to all methods in a controller, instead of writing the same thing in each method. As in I have as below, written in each method so that a can pass it with compact to each returning view.

$status = auth()->user()->role;

Please sign in or create an account to participate in this conversation.