PHP code example of solivellaluisalberto / laravelmakefiltersandsorts
1. Go to this page and download the library: Download solivellaluisalberto/laravelmakefiltersandsorts 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/ */
solivellaluisalberto / laravelmakefiltersandsorts example snippets
'providers' => [
// Otros providers...
SolivellaLuisAlberto\LaravelMakeFiltersAndSorts\MakeFiltersAndSortsServiceProvider::class,
],
use Illuminate\Http\Request;
use SolivellaLuisAlberto\LaravelMakeFiltersAndSorts\FilterService;
class ExampleController extends Controller
{
public function index(Request $request)
{
$query = MyModel::query();
// Aplicar filtros y ordenamientos usando la función del paquete
$query = FilterService::sanitizeFiltersAndSorts($request, $query);
return $query->get();
}
}