mardi 3 octobre 2017

Returning error from controller to ajax call

I have switch case in my controller and I would like to return error variable which is translated text, into my ajax call.

switch (true) {
        case (($to <= $from) && ($statistics > $from)):
            $error = [trans('report.errors.combine')];
            return $error;
            break;
        case ($to <= $from):
            $error = [trans('report.errors.to_date')];
            return $error;
            break;
        case ($statistics > $from):
            $error = [trans('report.errors.statistics')];
            return $error;
            break;
        default:
            $this->generate($request);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire