bonjour,
y a t-il moyen d'optimiser ce code ?
car la clause where est facultatif selon le formulaire de filtrage :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
if (empty(Input::get('channelName'))) {
            $channels = Channel::orderBy('updated_at', 'desc')->paginate($perPage)->setPath('?limit=' . $perPage);
        } else {
            $channels = Channel::where('name', 'like', '%' . Input::get('channelName') . '%')->orderBy('updated_at', 'desc')->paginate($perPage)->setPath('?limit=' . $perPage);
        }
        return view('admin.channels.list')->with('channels', $channels);