I`m new to the laravel 5.4.i developed search_code controller like this.
public function search_code(Request $request){
$query = $request->search;
$queryType = $request->institute; // 'id' or 'name'
$items = DB::table('registerdetails');
if($queryType == 'id'){
$items = $items->where('trainee_id', 'LIKE',"%$query%");
}
if($queryType == 'full_name'){
$items = $items->where('full_name', 'LIKE',"%$query%");
}
$items = $items->get();
return view('traineeattendance.index')->with('items',$items);
}
What i need is $item need to be pass and get called in two different views from this controller like
return view('traineeattendance.index')->with('items',$items);
And
return view('traineeattendance.attendance')->with('items',$items);
How can i do it?