I want to show the number of search results if there are and if not, I want to show a message that there are no results for your search
controller
public function search(Request $request){
$search = $request->get('search');
$Airline['Airlines'] = DB::table('airlines')->where(DB::raw("CONCAT(id,' ',name,' ',country)"),'LIKE','%'.$search.'%')->paginate(4);
$count = count($Airline);
if ($count>0) {
return redirect()->view('admin.airline',$Airline,)->with('success',$count.' records found');
}
else{
return redirect()->view('admin.airline',$Airline)->with('error','No record found');
}
}
airline.blade.php
@if(session()->has('success'))
<div class="alert alert-success">
{{ session()->get('success') }}
</div>
@endif
@if(session()->has('error'))
<div class="alert alert-danger">
{{ session()->get('error') }}
</div>
@endif