2024-03-07 00:58:14 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Form\Data;
|
|
|
|
|
|
|
|
use App\Form\Fields\Field;
|
|
|
|
use App\Form\Fields\NamiField;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @extends Collection<int, Field>
|
|
|
|
*/
|
|
|
|
class FieldCollection extends Collection
|
|
|
|
{
|
|
|
|
|
|
|
|
public function forMembers(): self
|
|
|
|
{
|
|
|
|
return $this->filter(fn ($field) => $field->forMembers === true);
|
|
|
|
}
|
|
|
|
|
2024-03-07 22:38:46 +01:00
|
|
|
public function withNamiType(): self
|
|
|
|
{
|
|
|
|
return $this->filter(fn ($field) => $field->namiType !== null);
|
|
|
|
}
|
|
|
|
|
2024-03-07 00:58:14 +01:00
|
|
|
public function noNamiType(): self
|
|
|
|
{
|
|
|
|
return $this->filter(fn ($field) => $field->namiType === null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function noNamiField(): self
|
|
|
|
{
|
|
|
|
return $this->filter(fn ($field) => !is_a($field, NamiField::class));
|
|
|
|
}
|
|
|
|
}
|