Argument 1 passed t be an instance of IlluminateHttpRequest, array given










5















Why am I getting the following error?



Argument 1 passed to AppHttpControllersController::validate() must be an instance 
of IlluminateHttpRequest, array given, called in
app/Http/Controllers/Admin/Auth/AuthController.php on line 72 and defined


Functions:



protected function loginValidation($request)

$rules = array(
'fname' => 'required
protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation(Request::all());

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Updated Code:



public function validate($request, $rules)

$rules = array(
'fname' => 'required



protected function getLoginCredentials(Request $request)

$validator = $this->validate($request, $rules);

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Error:



Declaration of AppHttpControllersAdminAuthAuthController::validate() should be compatible with AppHttpControllersController::validate(IlluminateHttpRequest $request, array $rules, array $messages = Array, array $customAttributes = Array)









share|improve this question
























  • can you show the validate function

    – oseintow
    Mar 19 '16 at 22:23











  • @oseintow its loginValidation thats there

    – Jess McKenzie
    Mar 19 '16 at 22:26















5















Why am I getting the following error?



Argument 1 passed to AppHttpControllersController::validate() must be an instance 
of IlluminateHttpRequest, array given, called in
app/Http/Controllers/Admin/Auth/AuthController.php on line 72 and defined


Functions:



protected function loginValidation($request)

$rules = array(
'fname' => 'required
protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation(Request::all());

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Updated Code:



public function validate($request, $rules)

$rules = array(
'fname' => 'required



protected function getLoginCredentials(Request $request)

$validator = $this->validate($request, $rules);

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Error:



Declaration of AppHttpControllersAdminAuthAuthController::validate() should be compatible with AppHttpControllersController::validate(IlluminateHttpRequest $request, array $rules, array $messages = Array, array $customAttributes = Array)









share|improve this question
























  • can you show the validate function

    – oseintow
    Mar 19 '16 at 22:23











  • @oseintow its loginValidation thats there

    – Jess McKenzie
    Mar 19 '16 at 22:26













5












5








5


1






Why am I getting the following error?



Argument 1 passed to AppHttpControllersController::validate() must be an instance 
of IlluminateHttpRequest, array given, called in
app/Http/Controllers/Admin/Auth/AuthController.php on line 72 and defined


Functions:



protected function loginValidation($request)

$rules = array(
'fname' => 'required
protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation(Request::all());

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Updated Code:



public function validate($request, $rules)

$rules = array(
'fname' => 'required



protected function getLoginCredentials(Request $request)

$validator = $this->validate($request, $rules);

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Error:



Declaration of AppHttpControllersAdminAuthAuthController::validate() should be compatible with AppHttpControllersController::validate(IlluminateHttpRequest $request, array $rules, array $messages = Array, array $customAttributes = Array)









share|improve this question
















Why am I getting the following error?



Argument 1 passed to AppHttpControllersController::validate() must be an instance 
of IlluminateHttpRequest, array given, called in
app/Http/Controllers/Admin/Auth/AuthController.php on line 72 and defined


Functions:



protected function loginValidation($request)

$rules = array(
'fname' => 'required
protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation(Request::all());

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Updated Code:



public function validate($request, $rules)

$rules = array(
'fname' => 'required



protected function getLoginCredentials(Request $request)

$validator = $this->validate($request, $rules);

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();




Error:



Declaration of AppHttpControllersAdminAuthAuthController::validate() should be compatible with AppHttpControllersController::validate(IlluminateHttpRequest $request, array $rules, array $messages = Array, array $customAttributes = Array)






php laravel laravel-5.2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 19 '16 at 22:54







Jess McKenzie

















asked Mar 19 '16 at 22:13









Jess McKenzieJess McKenzie

4,1842083141




4,1842083141












  • can you show the validate function

    – oseintow
    Mar 19 '16 at 22:23











  • @oseintow its loginValidation thats there

    – Jess McKenzie
    Mar 19 '16 at 22:26

















  • can you show the validate function

    – oseintow
    Mar 19 '16 at 22:23











  • @oseintow its loginValidation thats there

    – Jess McKenzie
    Mar 19 '16 at 22:26
















can you show the validate function

– oseintow
Mar 19 '16 at 22:23





can you show the validate function

– oseintow
Mar 19 '16 at 22:23













@oseintow its loginValidation thats there

– Jess McKenzie
Mar 19 '16 at 22:26





@oseintow its loginValidation thats there

– Jess McKenzie
Mar 19 '16 at 22:26












1 Answer
1






active

oldest

votes


















1














Change to



 $validator = $this->loginValidation($request);


With this you pass an instance of Request to the validate function



you are passing an array to the first argument of the validate function which i guess should be an instance of Request



$this->validate( $request , $rules);


Updated



protected function loginValidation($request)

$rules = array(
'fname' => 'required

protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation($request);

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();







share|improve this answer

























  • But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

    – Jess McKenzie
    Mar 19 '16 at 22:34











  • @JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

    – Ambulare
    Mar 19 '16 at 22:36











  • Thanks now I get an error of: Undefined variable: rules

    – Jess McKenzie
    Mar 19 '16 at 22:39











  • line number and file

    – oseintow
    Mar 19 '16 at 22:43











  • @JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

    – Ambulare
    Mar 19 '16 at 22:44











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36107836%2fargument-1-passed-t-be-an-instance-of-illuminate-http-request-array-given%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Change to



 $validator = $this->loginValidation($request);


With this you pass an instance of Request to the validate function



you are passing an array to the first argument of the validate function which i guess should be an instance of Request



$this->validate( $request , $rules);


Updated



protected function loginValidation($request)

$rules = array(
'fname' => 'required

protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation($request);

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();







share|improve this answer

























  • But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

    – Jess McKenzie
    Mar 19 '16 at 22:34











  • @JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

    – Ambulare
    Mar 19 '16 at 22:36











  • Thanks now I get an error of: Undefined variable: rules

    – Jess McKenzie
    Mar 19 '16 at 22:39











  • line number and file

    – oseintow
    Mar 19 '16 at 22:43











  • @JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

    – Ambulare
    Mar 19 '16 at 22:44
















1














Change to



 $validator = $this->loginValidation($request);


With this you pass an instance of Request to the validate function



you are passing an array to the first argument of the validate function which i guess should be an instance of Request



$this->validate( $request , $rules);


Updated



protected function loginValidation($request)

$rules = array(
'fname' => 'required

protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation($request);

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();







share|improve this answer

























  • But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

    – Jess McKenzie
    Mar 19 '16 at 22:34











  • @JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

    – Ambulare
    Mar 19 '16 at 22:36











  • Thanks now I get an error of: Undefined variable: rules

    – Jess McKenzie
    Mar 19 '16 at 22:39











  • line number and file

    – oseintow
    Mar 19 '16 at 22:43











  • @JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

    – Ambulare
    Mar 19 '16 at 22:44














1












1








1







Change to



 $validator = $this->loginValidation($request);


With this you pass an instance of Request to the validate function



you are passing an array to the first argument of the validate function which i guess should be an instance of Request



$this->validate( $request , $rules);


Updated



protected function loginValidation($request)

$rules = array(
'fname' => 'required

protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation($request);

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();







share|improve this answer















Change to



 $validator = $this->loginValidation($request);


With this you pass an instance of Request to the validate function



you are passing an array to the first argument of the validate function which i guess should be an instance of Request



$this->validate( $request , $rules);


Updated



protected function loginValidation($request)

$rules = array(
'fname' => 'required

protected function getLoginCredentials(Request $request)

$validator = $this->loginValidation($request);

var_dump($validator); die();

if($validator->passes())

return[
'email' => Request::input('email'),
'password' => Request::input('password'),
'type' => 1
];

return true;
else
return redirect()->back()->withErrors();








share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 19 '16 at 23:00

























answered Mar 19 '16 at 22:31









oseintowoseintow

4,53221524




4,53221524












  • But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

    – Jess McKenzie
    Mar 19 '16 at 22:34











  • @JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

    – Ambulare
    Mar 19 '16 at 22:36











  • Thanks now I get an error of: Undefined variable: rules

    – Jess McKenzie
    Mar 19 '16 at 22:39











  • line number and file

    – oseintow
    Mar 19 '16 at 22:43











  • @JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

    – Ambulare
    Mar 19 '16 at 22:44


















  • But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

    – Jess McKenzie
    Mar 19 '16 at 22:34











  • @JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

    – Ambulare
    Mar 19 '16 at 22:36











  • Thanks now I get an error of: Undefined variable: rules

    – Jess McKenzie
    Mar 19 '16 at 22:39











  • line number and file

    – oseintow
    Mar 19 '16 at 22:43











  • @JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

    – Ambulare
    Mar 19 '16 at 22:44

















But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

– Jess McKenzie
Mar 19 '16 at 22:34





But then what would I do with the $this->validate( $request , $rules); in the login function when I rename it to validate?

– Jess McKenzie
Mar 19 '16 at 22:34













@JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

– Ambulare
Mar 19 '16 at 22:36





@JessMcKenzie - the same thing that you're currently doing. The error message is just saying that you need to pass that function the full Request object, not the results of the Request::all() method.

– Ambulare
Mar 19 '16 at 22:36













Thanks now I get an error of: Undefined variable: rules

– Jess McKenzie
Mar 19 '16 at 22:39





Thanks now I get an error of: Undefined variable: rules

– Jess McKenzie
Mar 19 '16 at 22:39













line number and file

– oseintow
Mar 19 '16 at 22:43





line number and file

– oseintow
Mar 19 '16 at 22:43













@JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

– Ambulare
Mar 19 '16 at 22:44






@JessMcKenzie is your code still exactly the same as above, but you've replaced loginValidation(Request::all()) with loginValidation($request) ?

– Ambulare
Mar 19 '16 at 22:44




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36107836%2fargument-1-passed-t-be-an-instance-of-illuminate-http-request-array-given%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3