i want make searching to search my data. i want to make my search can search data from any column. but i dont know how ?
here my Controller :
public function index()
{
return view('search');
}
public function getName()
{
$input = Input::get('cari');
$name = \App\Orang::where('tanggal', 'LIKE', ''.$input.'%')
->orderBy('id', 'desc')
->paginate(6);
return view('hasil', compact('tanggal'), ['name'=>$name]);
}
and this view for search :
<form action="/hasile" action="GET">
<div class="form-group">
<label for="cari">data yang dicari</label>
<input type="text" class="form-control" id="cari" name="cari" placeholder="cari">
</div>
<input class="btn btn-primary" type="submit" value="Update data">
</form>
this my view for showing data :
@if (count($name) > 0)
@foreach ($name as $data)
=> <br>
@endforeach
@else
Data tidak ditemukan.
@endif
and here my rooter :
Route::get('golek','GolekController@index');
Route::get('hasile', 'GolekController@getName');
and this my table database :
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire