I am having a controller that I need the access with post and get routing. The post request is getting userinfo to login to a api. The get request is used the redirect back after an error from a link on the page.
But when I redirect back to the page with a get request is gets into a loop. Is there an option to disable the validation request when I use the get method ?
Function inside the controller
public function select(BsLogin $request)
{
<<code>>
}
BSlogin is a request validator with some basic rules in it.
Do I need to remove it from this position and move in in the function and check if there is a post or get request and only do the validation on the post request ? And if so how can I use the external request file for validation inside the function.
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if ($this->isMethod('post')) {
return [
// your rules
];
}
return []; // empty array for get request
}