public function Search(Request $request) { $name = $request->input('name'); $artist = $request->input('artist'); $type = 2; if ($name == null && $artist == null) { } else { if ($name != null && $artist == null) { $songs = \App\Models\Song::search_by_song($name, $type); return $songs; } else { if ($name == null && $artist != null) { $songs = \App\Models\Song::search_by_singer_ajax($artist); return $songs; } else { $songs = \App\Models\Song::search_by_singer_song_ajax($name, $artist); return $songs; } } } }