I recommend you using redis . When one user have more and more friends, your mysql table will be very very big. In that case if you query friends information from mysql, it is not a good idea. You query will be very slow.
In this case, you'd better using some Cache Tools to improve your application, such as Memcache Redis ..
But I need to find a way to grap the status updates from my friends. I will work on the rest later.
I tried this but is not working
public function getStatusUpdatesFromFriends() {
$user = \Auth::user();
$friend_list = $user->friends()->lists('id');
$revFriends_list = $user->revFriends()->lists('id');
$friends = array_unique(array_merge($friend_list, $revFriends_list));
$friends[] = $user->id; // To show my own updates
// dd($friends);
$statuses = $this->model->with(array('users' => function($query) use($friends) {
$query->whereIn('user_id', $friends);
}))->get();
dd($statuses);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community