Laravel 5.4: Relationship returning wrong value? (Getting first?)

ساخت وبلاگ

Vote count: 0

Relationship is giving a different value to the direct column in Laravel 5.4?

When I do:

{{ Auth::user()->roleplay->businessPosition->position_id }}

it returns the right position id (6 atm)


When I do this:

public function businessPosition()
{ return $this->hasOne('AppDatabaseFrontendRoleplayBusinessBusinessPositions', 'business_id', 'business_id', 'business_position', 'position_id');
}

It always returns 1?

Can anyone help me out here? this is basically what I am trying to do..

SELECT * FROM `srp_business_positions` WHERE `business_id` = 'users business id here' AND position_id = 'users position id here' LIMIT 1;

Here is my BusinessPositions modal:

asked 26 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 268 تاريخ : سه شنبه 5 ارديبهشت 1396 ساعت: 23:54