balaji00710's avatar

How to get User from the data collection based on the user id

Sorry for my english..i am new to laravel.. Actually am trying to get data from a table also the user data... In the table am stored the user id along with the data... Now i need to get the data and also the User data... Can anyone please help me...

0 likes
2 replies
cipsas's avatar

With eloquent model:

User::find($id)

Or make query:

$user = DB::table('users')->where('id', $id)->first();
1 like
balaji00710's avatar

sorry i got the answer by google it... function admin(Data $data){ $data = $data->whereMonth('created_at','=',Date('m')) ->whereDay('created_at','=',Date('d')) ->with('user') ->orderBy('user_id','ASC') ->get(); }

Please or to participate in this conversation.