Skip to content

Commit

Permalink
Improved AdminRecipe
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaplet committed May 3, 2024
1 parent 3d6693f commit 020d6a0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Recipe/AdminRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Megio\Collection\CollectionRequest;
use Megio\Collection\ReadBuilder\Column\EmailColumn;
use Megio\Collection\ReadBuilder\ReadBuilder;
use Megio\Collection\SearchBuilder\Searchable;
use Megio\Collection\SearchBuilder\SearchBuilder;
use Megio\Collection\WriteBuilder\Field\Base\EmptyValue;
use Megio\Collection\WriteBuilder\WriteBuilder;
use Megio\Collection\WriteBuilder\Field\EmailField;
Expand All @@ -26,6 +28,16 @@ public function key(): string
return 'admin';
}

public function search(SearchBuilder $builder, CollectionRequest $request): SearchBuilder
{
$builder
->keepDefaults()
->addSearchable(new Searchable('email'))
->addSearchable(new Searchable('lastLogin'));

return $builder;
}

public function read(ReadBuilder $builder, CollectionRequest $request): ReadBuilder
{
return $builder->buildByDbSchema(['password']);
Expand Down

0 comments on commit 020d6a0

Please sign in to comment.