I wrote a code to search in within a data table whereby entering a id and customer name but i need to search extra field without specifying the column.
I need to search by column, there's the controller with Search function:
public function search(Request $request)
{
if ($request->ajax()) {
$output = "";
$indents = DB::table('indents')
->where('id', 'LIKE', '%' . $request->search . '%')
->orwhere('customer_name', 'LIKE', '%' . $request->search . '%')
->orwhere('*', 'LIKE', '%'.$request->search. '%')
->get();
$count=1;
foreach ($indents as $key => $indent) {
$output .= '<tr>' .
'<td>'.$count++.'</td>'.
// '<td>' . $indent->id . '</td>' .
'<td>' . $indent->customer_name . '</td>' .
'<td>' . $indent->phone_no . '</td>' .
'<td>' . $indent->date_of_delivery . '</td>' .
'<td>' . $indent->delivery_at . '</td>' .
'<td>' . '.<a href="' . route('edp.show', $indent->id) . '">.' . '<img src="assets/images/select.jpg" class="imgsize">.' . '</a>.' . '</td>' .
'</tr>';
}
return Response($output);
}
}