I has UserRolePlan
that belongsTo RoleInfo
class UserRolePlan extends Model
{
public function roleInfo()
{
return $this->belongsTo(RoleInfo::class,'role_info_id');
}
}
I get the desired result with this code
\DB::table('user_role_plans')
->join('role_infos', 'user_role_plans.role_info_id', '=', 'role_infos.role_info_id')
->select('user_role_plans.user_role_plan_id', 'role_infos.is_active')
->get()
But with this code
UserRolePlan::with("roleInfo")
->select("user_role_plans.user_role_plan_id", "roleInfo.is_active")
->get()
I get error that Unknown column 'roleInfo.is_active'
.
How can select column from relationship besides main table?
I want relationship column and base table together...