Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach($self_conversations as $self_conversations_fetch){
- //fetching each conversation id
- $conversation_id = Conversation::find($self_conversations_fetch->conversation_id);
- $user_id = array();
- //fetching each conversation member's id
- foreach($conversation_id->conversationsMember as $conversationmembers)
- $user_id[] = $conversationmembers->user_id;
- $self_id = User::where('email', Session::get('email'))->first()->id;
- $self_id_array = array($self_id);
- $friend_id_array = array_diff($user_id, $self_id_array);
- foreach($friend_id_array as $friend_id) array_push($friend_ids, $friend_id);
- $conversations_reply_obj = ConversationReply::where('conversation_id', $self_conversations_fetch->conversation_id)->orderBy('updated_at', 'desc')->first();
- $conversations_reply[] = $conversations_reply_obj['reply'];
- }
- $conversations_reply[] = $conversations_reply_obj['reply'];
- $users = User::all(); // returns a collection
- $users = User::all();
- $users->first();
- $user = User::first();
- $users = User::all();
- $users = User::get(0) // to get first item/model
- $users = User::get(1) // to get second item/model
- $users = User::get(); // same as all
- // pass the collection to the view
- return View::make('users.index')->with('users', $users);
- @foreach($users as $user)
- {{ $user->username }}<br />
- {{ $user->email }}<br />
- @endforeach
- $user = user::find(1); // 1 is id for example
- return View::make('users.index')->with('user', $user);
- $user = User::where('username', 'me')->get();
- return View::make('users.index')->with('user', $user);
- {{ $user->name }}
- {{ $user['name'] }}
- $student->school->school_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement