php - Laravel return Response::view -


simple question, think.

i have route calls function in controller. in controller, have call controller function.

for example:

$_testing = with(new testingcontroller)->prepwork($variable1,$variable2); 

inside of testingcontroller prepwork(), if condition matches,

return response::view(...); 

question - how come isn't enough? return returns control calling function (which makes sense), how tell laravel - stop doing , output view.

to make work, have to:

$_testing = with(new testingcontroller)->prepwork($variable1,$variable2); return $_testing; 

that doesn't work prepwork designed heavy lifting , output result model. view kicked off when there error.

and yes - know can this:

if ($_testing->whatimcheckingforerrors) { return response::view(...); } 

i'm trying understand why return response::view doesn't end processing... if makes sense.

only last return end processing, because application receive last return , render whatever send in it.

if call method (1), calls method (2), calls third 1 (3), laravel app receive view when return (1).

that's why when added last return worked.

there things can do, like:

echo response::view(...); die; 

it may work sometimes,

but bad, not unless you're testing things!

because laravel won't able close , flush whatever needs , can compromise application , server.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -