<form action="{{ action('DashboardController@getSearchAuctions') }}" method="get" class="row" style="margin-top: 25px"> <div class="col-xs-2 form-group"> <input type="text" name="title" class="form-control" value="@if(isset($request)){{ $request->title }}@endif" placeholder="Пошук за назвою та ID"> </div> <div class="col-xs-2 form-group"> <select class="form-control" name="category"> <option value>Категорія</option> <?php $categories = App\Cat::roots()->get(); ?> @foreach($categories as $category) <option value="{{ $category->id }}" @if(isset($request) && $request->category == $category->id) selected @endif>{{ $category->name }}</option> @endforeach </select> </div> <div class="col-xs-2 form-group"> <select class="form-control" name="status"> @if(isset($request) && $request->status == 'del') <option value="del" @if(isset($request) && $request->status == 'del') selected @endif>Статус</option> @foreach(trans('theme.statuses') as $key => $status) <option value="{{ $key }}">{{ $status }}</option> @endforeach @else <option value="del">Статус</option> @foreach(trans('theme.statuses') as $key => $status) <option value="{{ $key }}" @if(isset($request) && $request->status == $key) selected @endif>{{ $status }}</option> @endforeach @endif
function get_cats() { $cats = Cache::rememberForever('cats', function () { return App\Cat::select('id', 'name', 'parent', 'slug')->latest()->get(); }); return $cats; }