Closed aceart closed 7 years ago
Hi @aceart Thank you so much for this! I totally agree on your first point.. I didn't think about it (starts_with) Same for the second one (passing $validator)
I don't think you'd need to set the Accept header to json
Would you be able to send a PR targeting master with the first 2 changes? Thanks!
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] support request
[ ] other (Please specify)
Provide information & explanation There are some Problems with the validate-function at the Controller.php class
Firstly I think the routes prefix check should be changed to:
I had some issues with multiple chained api routes. For example: I had a separate api route für backend issues that had another prefix called 'backend'. So the `Route::current()->getPrefix() returned "api/backend/" which is not covered by the if-statement.
Another error occured with the
throw new ValidationException($message);
statement. I think it should be changed tothrow new ValidationException($validator);
. The ValidationException only accepts classes by the type of "Validators". A paramenter type of String raises an exception.Beside that I did change the request header to json. But I don't know if this is necessary. I do only want to communicate over json at my api routes. I don't know if its general purpose.
Here is my suggestion. Maybe it helps :)