如果您想查看在给定日期到期的圆顶,我有一个下拉选项可供选择。
但是一旦我选择了日期,我将得到具有正确结果的纯 json 代码。这是我在表格上方的表格
<form method="post" action="{{ action('DomenController@tabela') }}" id="klijent_rok" onchange="document.getElementById('klijent_rok').submit()">
@csrf
<div class="form-group row">
<label for="istice_za" class="ml-md-auto col-form-label text-md-left" style="padding-right: 10px;">Ističu u roku od:</label>
<select name="istice_za" id="istice_za" class="form-control" style="width: 140px" size="1">
<option value="99" @if($istice_za == '99') selected='selected' @endif>-neodređeno-</option>
<option value="7" @if($istice_za == '7') selected='selected' @endif>za 7 dana</option>
<option value="30" @if($istice_za == '30') selected='selected' @endif>za 30 dana</option>
<option value="60" @if($istice_za == '60') selected='selected' @endif>za 60 dana</option>
<option value="istekli" @if($istice_za == 'istekli') selected='selected' @endif>istekli</option>
</select>
<a href="/lista-domena" class="btn btn-info" style="height: 37px; margin-left: 10px; margin-right: 15px">Poništite filtere</a>
</div>
</form>
这是服务器端数据表的矿井控制器
if(!empty($request->istice_za) && $request->istice_za != 99) {
$date = Carbon::now();
$new_date = Carbon::now();
if($request->istice_za != 'istekli') {
if($request->istice_za == 7) {
$istice_za = 7;
$new_date->addDays(7);
}
if($request->istice_za == 30) {
$istice_za = 30;
$new_date->addDays(30);
}
if($request->istice_za == 60) {
$istice_za = 60;
$new_date->addDays(60);
}
$domen = Domen::where('datum_end', '<', $new_date)
->Where('datum_end', '>', $date)
->with('klijent');
}
else {
$domen = Domen::where('datum_end', '<', $date)->with('klijent');
$istice_za = 'istekli';
}
}
else {
$domen = Domen::with('klijent');
$istice_za = 99;
}
return datatables()->of($domen)->make(true);
这些是我的路线
Route::get('/lista-domena/tabela', 'DomenController@tabela');
Route::post('/lista-domena/tabela', 'DomenController@tabela');
我做错了什么并且没有在我的表中获取该数据?