So in a controller I'm accessing the
establishment property of the authenticated user, which returns an Eloquent
I'm accessing it in several places, currently like so:
Which I feel is bad. I'd really like to inject the establishment into the controller __construct method so I can access it as
$this->establishment, but when I do, it returns a
new instance of the establishment, not the user's establishment.
I've tried declaring a singleton in a service container and setting it to Auth::user()->establishment, but Auth::check() is returning false because (I'm guessing) the user hasn't been resolved?
I feel like I'm close to a solution. If there are any Laracasts or articles that might shed some light, that'd be ace.
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.