1. Go to this page and download the library: Download samavidev/model-filtration 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/ */
samavidev / model-filtration example snippets
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use SamaviDev\ModelFiltration\Attributes\Filter;
#[Filter(['name' => 'username'])]
class User extends Authenticatable
{
...
}
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use SamaviDev\ModelFiltration\Attributes\Filter;
#[Filter('id')]
#[Filter(['name' => 'username'])]
class User extends Authenticatable
{
...
}
namespace App\Attributes;
use Attribute;
use SamaviDev\ModelFiltration\Contracts\Group;
#[Attribute]
class UsersFilter implements Group
{
public function props(): array
{
return [
'or' => ['attribute', ...]
'and' => ['attribute' => 'alias', ...],
...
];
}
}
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Attributes\UsersFilter;
#[UsersFilter]
class User extends Authenticatable
{
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.