When i use a specific request (example: StorePostRequest) and then try to update with PUT method, always throws an "Method not allowed" exception. It is ok ? The route:list command shows the "PUT posts" route. I can't understand why is wrong.
"Method not allowed" means that you are trying to use the wrong HTTP request method on that route, e.g. sending a GET or POST request to a route that is expecting PUT.
Can you show the code for how you are trying to do this request?
<form method="POST" action="http://example.com/home/" accept-charset="UTF-8">
<input type="hidden" name="_method" value="PUT" />
<!-- The rest of your form -->
</form>
Since the HTML form cannot handle method="PUT" you would need to use method="POST" and the hidden input field with the name _method and as value you can use: DELETE, PUT, PATCH (and the other request methods if I forgot any of them).
You can also get this issue if your route expects a parameter and you don't pass it, or you pass a parameter and there is no place for it in the route.
I have not html form because it will be consumed by another php script via Guzzle or similar. Actually i am using Postman. It works fine with validation on controller, but fails just when uses specific request like "App\Requests\StorePostRequest".
class StorePostRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'title' => 'required|between:3,255',
];
}
}