Support the ongoing development of Laravel.io →
Database Eloquent Views
Last updated 1 year ago.
0

Hmm....I can't really see anything except maybe calling paginate(25) at the end instead of repeating it by building upon a single query:

public function index($label = 'false')
{
    $search = Input::get('search');
    $query = Appointment::query();

    if(Input::has('search')) {
        $query->where('appointment', 'LIKE', '%'. $search .'%');
    } elseif($label !== 'false') {
        $query->orderBy($order, $sort)->where('label', '=', $label);
    }
    
    $appointments = $query->paginate(25);
    return view('appointments.index', compact('appointments', 'search', 'label'));
}
0

Awesome, thanks for your reply once again, I didn't know this either yet :)

Edit: And I see I am using two accounts on here.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Hardist hardist Joined 26 May 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.