Repository
Introduction
Form repositories are used to create an entry
when creating and to update an entry
when editing. The repository is guessed based on the type of model used.
Custom repositories are a rare need.{.note}
If you would like to or need to define the repository yourself you can do so on the form builder.
protected $repository = \Example\Test\FancyFormRepository::class;
You can also set an instantiated repository on the builder dynamically:
$builder->setRepository(app(MyFormRepository::class);
The form repository must implement \Anomaly\Streams\Platform\Ui\Form\Contract\FormRepositoryInterface
and implement the following methods:
/**
* Find an entry or return a new one.
*
* @param $id
* @return mixed
*/
public function findOrNew($id);
/**
* Save the form.
*
* @param FormBuilder $builder
* @return bool|mixed
*/
public function save(FormBuilder $builder);