I have a select that when I change the value it should reorder a list, eg by id, name, etc. without Laravel I would use a onchange
function and pass the sort order to a PHP page that would print this list sorted for me ...
But how to do this with Laravel? Will I have to generate a view ? I tried but could not ...
I was trying here and I think I'm wrong to generate the views ..
I have a layout view that has a @yeld ('content')
, in case I would need to update only that content, however, when I do:
$this->layout->content = View::make('usuarios.index', $variaveis);
It duplicates my layout within the div content
// Follow the controller
if(Request::ajax()){
$usuarios = Usuario::orderBy(Input::get('order'),'ASC')->get();
$variaveis = array('usuarios' => $usuarios);
return View::make('usuarios.index', $variaveis);;
}else{
$usuarios = Usuario::orderBy('id','ASC')->get();
$variaveis = array('usuarios' => $usuarios);
$this->layout->content = View::make('usuarios.index', $variaveis);
}
But he is never entering Request :: ajax () and I can not figure out why