1 month ago

protected $has = ['something‘] possible?

Posted 1 month ago by Mikegk

Hi guys,

I wonder if it's possible to make an Eloquent-Model always involve an existent Relationship. For Example a Post should always have an active User (\App\Post::find(1)->has('user')->first()). Using

protected $with = ['user'];


So is it possible to define the $has like that as well?

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