I am trying to figure out how to add a BACK button only when search results in my simple search takes place. I added some pseudo code in the Controller below (the sad if statement in the code) but I am not sure how to work this out or if it should be in the controller or the view.
public function search(Request $request)
{
$search = $request->get('search');
$contacts = DB::table('contacts')
->where('first_name', 'like', '%' .$search. '%')
->paginate(10);
//TRYING TO ADD THIS TYPE OF FUNCTIONALITY:::::::::::
if (search occurs) {
# then add "back button to view"
<a href="">Back</a>
}
return view('contacts.index', ['contacts' => $contacts]);
}
Aucun commentaire:
Enregistrer un commentaire