jeudi 5 août 2021

Terminate method in middleware in laravel

I wanted to define a case if a function return false in a terminate() method in laravel middleware so this is what I did

    $parsedData = $this->parse($request);
    if(!$parsedData){
        dd("hello");
    }

the condition is running fine but when I am calling response it is not showing anything

$parsedData = $this->parse($request);
if(!$parsedData){
            return Response::json(array(
            'success' => false,
            'info' => "error"
        ), 422);
} 
\\ called the Response helper 

am I doing anything wrong in this case?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire