PHP code example of magetech / laravel-query-toolkit
1. Go to this page and download the library: Download magetech/laravel-query-toolkit 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/ */
magetech / laravel-query-toolkit example snippets
declare(strict_types=1);
namespace App\QueryFilters;
use Illuminate\Database\Eloquent\Builder;
use MageTech\QueryToolkit\Filters\BaseFilter;
use MageTech\QueryToolkit\Enums\FilterType;
class ProductStatusFilter extends BaseFilter
{
public function __construct(string , ?string = null)
{
parent::__construct(, , FilterType::Custom);
}
protected function applyFilter(Builder , mixed , string ): Builder
{
return match () {
'published' => ->where('published_at', '<=', now()),
'draft' => ->whereNull('published_at'),
default => ->where(, ),
};
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.