Я пытаюсь фильтровать, используя выпадающий список (выберите), но я получил эту ошибку:
Неопределенная переменная: раскрывающиеся списки (представление: C: \ xampp \ htdocs \ bbnaijareport \ resources \ views \ report \ bbnaijaonetimebillingsReport.blade.php) "

модель
protected $fillable = [
'msisdn',
'created_at',
'amount',
'billing_channel',
];
public static function getFilters() {
$filter = DB::select(DB::raw('SELECT DISTINCT billing_channel AS filt FROM bbnaija_one_time_billings'));
foreach ($filter as $key => $value) {
$dropdown[$key] = $value->filt;
}
}
Контроллер
public function bbnaijaonetimebillingsReport(Request $request)
{
$data['title'] = 'Bbnaija One Time Billings';
$billings = DB::table('bbnaija_one_time_billings')
->select(
'msisdn',
'trans_id',
'ext_id',
DB::raw('created_at as created_date'),
'amount',
'is_complete_transactions',
'billing_channel'
)
->orderByRaw('created_at DESC');
$dropdowns=BbnaijaOneTimeBillings::getFilters();
$start_date = $request->start_date;
$end_date = $request->end_date;
$render=[];
if(isset($request->msisdn))
{
$billings=$billings->where('msisdn','like','%'.$request->msisdn.'%');
$render['msisdn']=$request->msisdn;
}
if(isset($request->billing_channel))
{
$billings=$billings->where('billing_channel',$request->billing_channel);
$render['billing_channel']=$request->billing_channel;
}
if(isset($request->start_date) && isset($request->end_date))
{
$billings=$billings->whereBetween('created_at',[$start_date.' 00:00:00',$end_date.' 23:59:59']);
$render['start_date']=$request->start_date;
$render['end_date']=$request->end_date;
}elseif(isset($request->start_date))
{
$billings=$billings->where('created_at',$request->start_date);
$render['start_date']=$request->start_date;
}
$billings= $billings->orderBy('created_at','DESC');
$billings= $billings->paginate(15);
$billings= $billings->appends($render);
$data["dropdowns"] = $dropdowns;
$data['billings'] = $billings;
return view('report.bbnaijaonetimebillingsReport',$data);
}
View
<div class="row" style="margin-bottom: 10px">
{{ Form::model(request(),['method'=>'get']) }}
<div class="col-sm-2">
{{ Form::text('msisdn',null,['class'=>'form-control','placeholder'=>'MSISDN']) }}
</div>
<div class="col-sm-2">
{{ Form::select('billing_channel',$dropdowns,null,['class'=>'form-control','placeholder'=>'Select Channel']) }}
</div>
<div class="col-sm-3">
{{ Form::date('start_date',null,['class'=>'form-control','placeholder'=>'Date']) }}
</div>
<div class="col-sm-3">
{{ Form::date('end_date',null,['class'=>'form-control','placeholder'=>'Date']) }}
</div>
<div class="col-xs-2">
{{ Form::submit('Search',['class'=>'btn btn-warning']) }}
<a href="{{ route('bbnaijaonetimebillingsexport') }}" class="btn btn-primary"><i class="fa fa-file-excel-o"></i> Excel</a>
</div>
{{ Form::close() }}
</div>
Проблема с
{{Form :: select ('billing_channel', $ dropdowns, null, ['class' => 'form-control', 'placeholder' => 'Select Channel'])}}
Я хочу фильтровать, используя billing_channel. Это поле из таблицы.
Как мне решить проблему
