diff --git a/app/Form/Actions/FormApiListAction.php b/app/Form/Actions/FormApiListAction.php new file mode 100644 index 00000000..9cfb13ce --- /dev/null +++ b/app/Form/Actions/FormApiListAction.php @@ -0,0 +1,29 @@ + + */ + public function handle(FilterScope $filter): Collection + { + return Form::withFilter($filter)->get(); + } + + public function asController(ActionRequest $request): AnonymousResourceCollection + { + return FormApiResource::collection($this->handle(FilterScope::fromRequest($request->input('filter', '')))); + } +} diff --git a/app/Form/FilterScope.php b/app/Form/FilterScope.php new file mode 100644 index 00000000..5d654050 --- /dev/null +++ b/app/Form/FilterScope.php @@ -0,0 +1,40 @@ + + */ +#[MapInputName(SnakeCaseMapper::class)] +#[MapOutputName(SnakeCaseMapper::class)] +class FilterScope extends Filter +{ + public function __construct() + { + } + + /** + * {@inheritdoc} + */ + public function locks(): array + { + return []; + } + + /** + * @param Builder