dimanche 3 juillet 2016

Laravel 5.1 Multiple Paginate in One Page

I don't quite understand the ajax script, so I have trouble to use this Laravel Ajax Multi Pagination with my code as following:

class HomeController extends Controller {

public function index() {

    if(Auth::check()) {

        $statuses = Status::NotReply()->NotFriendPostUserProfile()->where(function($query) {
            return $query->where('user_id', Auth::user()->id)
                        ->orWhereIn('user_id', Auth::user()->friends()->lists('id'));
        })->orderBy('created_at', 'desc')->paginate(4);

        $friendPosts = Status::NotReply()->FriendPostUserProfile()->where(function($query) {
            return $query->where('user_id', Auth::user()->id)
                        ->orWhereIn('user_id', Auth::user()->friends()->lists('id'));
        })->orderBy('created_at', 'desc')->paginate(4);

        return view('timeline.index')->with('statuses', $statuses)->with('friendPosts', $friendPosts);
    }

    return view('home');
}

I would like to use that script to show the posts (user posted on friend's wall and user/friend's status) in timeline. I am trying to make it looks like facebook timeline.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire