コード例 #1
0
<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
コード例 #2
0
ファイル: helpers.php プロジェクト: Vatia13/megaportal
 function get_cats()
 {
     $cats = Cache::rememberForever('cats', function () {
         return App\Cat::select('id', 'name', 'parent', 'slug')->latest()->get();
     });
     return $cats;
 }