You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a FormRequest that uses bound models as part of the request (for example the Rule::unique(...)->ignore(...) method, Scribe will throw an error because the model won't be there and the bound value is null;
TypeError
App\...\UpdateOrganisationRequest::organisationModel(): Return value must be of type Domain\Organisation, null returned
Of course when this isn't actually running an UPDATE request with a bound model, organisationModel will return a type error because $this->route('organisation') is actually null.
I know this isn't a bug of Scribe because the rules method has to run in order to extract the data but I was wondering if there is a suggested way to handle this?
One way I was thinking is being able to tell Scribe to ignore certain form requests using an attribute and then just manually providing the input data and rules.
We'd have to do that for each request though wouldn't we?
I guess there should be a callable $default parameter. But Scribe's default is just new $class, so you can just check the class name and fall back to that.
One way I was thinking is being able to tell Scribe to ignore certain form requests using an attribute and then just manually providing the input data and rules.
If you wish to do this, in v5, you can configure a strategy to ignore some endpoints, and then add a static data strategy:
Scribe version
4.40.0
Your question
When you have a FormRequest that uses bound models as part of the request (for example the
Rule::unique(...)->ignore(...)
method, Scribe will throw an error because the model won't be there and the bound value is null;Of course when this isn't actually running an
UPDATE
request with a bound model,organisationModel
will return a type error because$this->route('organisation')
is actually null.I know this isn't a bug of Scribe because the
rules
method has to run in order to extract the data but I was wondering if there is a suggested way to handle this?One way I was thinking is being able to tell Scribe to ignore certain form requests using an attribute and then just manually providing the input data and rules.
Docs
The text was updated successfully, but these errors were encountered: