I have a form that i want to authorize only if the call was made by ajax, so i tried
....
//MyRequest authorize function
public function authorize()
{
return $this->ajax();
}
But after when i do the ajax call, in the console it shown "This action is unauthorized."
, so how can i detect if the call was an ajax and return true
, else return false
?