lukaisailovic
2 years ago

Cannot use more than one request ?

Posted 2 years ago by lukaisailovic

Looks like my issue on GitHub was not right place to ask this and they told me to ask it here. So I will just copy-paste my issue.

  • Laravel Version: 5.5
  • PHP Version: 7

Description:

I'm using Laravel's request class to validate my request. I've done that for my register post method and trying to do it for Login Post but it wont work. I'm now using 5.5 but this happened to me in 5.4 also. I would just ignore it and try to write my validation logic in controller but it's ugly.

Steps To Reproduce:

I've created RegisterRequest with php artisan make:request command and used it in my controller like this:

public function RegisterPost(\App\Http\Requests\RegisterRequest $request)
    {
      $request->persist();
      return $this->RegisterShowMnemonic();
    }

Now I'm trying to do the same for my LoginPost. Used same command just replaced RegisterRequest with LoginRequest , and used it in my method but I get Class App\Http\Requests\LoginRequest does not exist like i haven't included it.

My method:

public function LoginPost(\App\Http\Requests\LoginRequest $request)
    {

    }

I've also try to include it on the top with Use and and then try it like that but same thing happens. I've manually check if file is there, if class match and it looks right to me. Weird thing is that everything just works with RegisterRequest

Please sign in or create an account to participate in this conversation.