jeudi 29 mars 2018

Render from another controller method

I'm using Laravel 5.5 version and I have a question.

Let's say that my controller has 2 methods like this:

public function errorsCheck(){
    return view('errors_check');
}

public function index(){
     $this->errorsCheck();
     // some other important code
}

And when I open my webpage it goes to index() method first. Then it calls errorsCheck(). And errorsCheck() has to render view file and stop script executing.

How can I do it? I can't make something like:

return $this->errorsCheck();

because I need code above to execute if errorsCheck method doesnt found any errors. And this is not validation errors, btw.

Any ideas? Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire