Question is: How to search by date and by description? What's my problem? I think it could work but it doesn't work at all.
Controller
public function index(Request $request){
$search = $request->get('search');
$date = $request->get('date');
$projects = Project::where('description', 'like', '%' . $search . '%')
->orWhere('created_at', '%Y-%m-%d','LIKE', '%'.$date.'%')
->orderBy("created_at", 'desc')
->paginate(10)
->withPath('?search=' . $search);
return view('projects.index', compact('projects'));
View
<div class="col-sm-12 form-group">
<div class="input-group">
<input class="form-control" name="date" type="date" >
<input class="form-control" name="search" type="text"/>
<div class="input-group-btn">
<button type="submit" class="btn btn-success">Search</button>
</div>
</div>
</div>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire