0

I am trying to store model data using CustomRequest with validation rules.

CustomController.php

/**
     * Store a newly created Exams in storage.
     *
     * @param CustomRequest $request
     *
     * @return Response
     */
    public function store(CustomRequest $request)
    {
        return new storeResponse($request);
    }

CustomRequest.php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CustomRequest extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return ['title' => 'required'];
    }
}

It works fine with normal Request class.


The error I am getting

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: POST.

A. Khaled
  • 1,468
  • 16
  • 28

0 Answers0