PHP code example of daveismyname / laravel-filters
1. Go to this page and download the library: Download daveismyname/laravel-filters library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
daveismyname / laravel-filters example snippets
return [
];
Route::group(['middleware' => ['web', 'auth']], function(){
Route::get('demo', function(){
$filters = Filters::get();
return view('demo');
});
});
<form method="get">
<div class="control-group">
<label for='savedfilter'>Use a saved filter:</label>
<select name='savedfilter' id="savedfilter" class='form-control' onchange="this.form.submit()">
<option value=''>Select</option>
@if ($filters)
@foreach($filters as $filter)
<option value='{{ $filter->id }}'>{{ $filter->title }}</option>
@endforeach
@endif
</select>
</div>
</form>
<form method="get">
<div class="control-group">
<label for='removefilter'>Remove a saved filter:</label>
<select name='removefilter' id="removefilter" class='form-control' onchange="this.form.submit()">
<option value=''>Select</option>
@if ($filters)
@foreach($filters as $filter)
<option value='{{ $filter->id }}'>{{ $filter->title }}</option>
@endforeach
@endif
</select>
</div>
</form>
<form method="get">
<div class="control-group">
<label for='filterTitle'>Save filter:</label>
<input class='form-control' id='filterTitle' type="text" name="filterTitle" value="" />
</div>
<div class="control-group">
<br><button type="submit" id='savefilter' class="btn btn-success" name="savefilter"><i class="fa fa-check"></i> Save Filter</button>
</div>
</form>
Filters::run('users', 'admin/users');
'providers' => [
// ...
Dcblogdev\Filters\FiltersServiceProvider::class,
];
bash
php artisan vendor:publish --provider="Dcblogdev\Filters\FiltersServiceProvider" --tag="migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="Dcblogdev\Filters\FiltersServiceProvider" --tag="config"