Better way to check if relations exists for canAccess

I'm looking at a better way to check if relations exists for canAccess. A lot of the time I need to do something a long the lines of auth()->user()->merchant()->exists() so I can do the select Project::where('merchant',auth()->user()-merchant->id)->first(); Because as you know if merchant doesn't have a user yet the relation breaks so I have to check each time. Looking for some advice as this seems to be a recurring issue. thanks
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?