A company
hasMany users
, this relationship is achieved through a pivot table. I want to be able to get the company.ID
of the company an individual user is related to:
$company_id = User::find(Auth()->$id)->companies->get('$id');
Unfortunately, I have also tried the pluck()
method, but to no success. How can one retrieve a specific value from a formula like this?