public function scopeName($query, $input) { if (trim($input) != '') { $query->where('name', 'LIKE', "%{$input}%"); } }