i'm trying to displaying single data like this
id TenantID name username password sendername senderpassword
------ -------- -------- -------------- --------------------- ----------------- -------------------------
4 1 yovhi2 yovhi2 somepassword a a
here my table
tb.users
id TenantID name username password
------ -------- -------- -------- -------------
1 1 yovhi yovhi
4 1 yovhi2 yovhi2
tb.masking
id TenantID senderid sendername senderpassword
------ -------- --------- ------------ ----------------
1 1 a a a
2 2 b b b
when joining table, i just get id user is only 1 when i'm login as user id 4, and when i'm give where clause id=session id in my code, this result is null.
here my Masking model
public function User()
{
return $this->belongsTo('User','TenantID');
}
controller
public function home()
{
$user=Masking::with('User')->where('TenantID','=',Session::get('tenant'))->
where('id','=',Session::get('user_id'))->get();
foreach ($user as $key) {
var_dump($key->User->id);
}
//return View::make('profile')->with(compact('key'))->with(compact('user'));
}
->where('id','=',Session::get('user_id'))->get();
You are getting a masking object by user's ID, in SQL language it's like:
SELECT * FROM `masking` WHERE `id` = <user_id>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community