Blank page when printing a Mysql statement using Laravel

0

I have this mysql statement

public function mayores(Request $req){$taquito=DB::select('select * from clientes where edad = ?', [18]);view('Layouts.mayores',compact('taquito'));}

to get all my clients older than 18 years old which is inside my controller and I use this route to enter the page Route::get('/mayores','Pincipalcontroller@mayores');

"Principalcontroller" being my controller where I have all the sentences and everything comes to this view

but always my result ends up being a totally blank page, you can not even see what is the menu linked to the view or the columns of the table without filling any solution? I have impressions to see all the clients which works well but when I try to filter them I get everything wrong and I can not find the solution

    
asked by Diego Pineda Cervantes 23.10.2017 в 14:57
source

1 answer

1

As far as I could appreciate, your problem is in several places 1 in your file of unspecified routes, well that the controller will be responsible for responding to your request in the / greater route Your controller is called PrincipalController and you pass it to the Route :: get PincipalController (Maybe it's wrong to copy your text here, because otherwise I would have thrown you an exception)

2 The most important, in your function of the Controller you must return the view you are going to render, and as far as you can see, you only execute the view function.

It should be:

public function mayores(Request $req){
    $taquito=DB::select('select * from clientes where edad = ?', [18]);
    /*Antes tenias view('Layouts.mayores',compact('taquito')); te faltaba el return*/
    return view('Layouts.mayores',compact('taquito'));
}
    
answered by 23.10.2017 / 15:10
source