/** * Display a listing of the resource. * * @return Response */ public function index($id = null) { if ($id == null) { $data['marcas'] = Marca::orderBy('id', 'asc')->get(); return $data; } else { return $this->show($id); } }
/** * Display a listing of the resource. * * @return Response */ public function index($id = null) { if ($id == null) { $data['productos'] = Producto::with('Marca')->with('unidadMedida')->orderBy('id', 'asc')->get(); $data['marcas'] = Marca::orderBy('id', 'asc')->get(); $data['unidadesMedidas'] = UnidadMedida::orderBy('id', 'asc')->get(); return $data; } else { return $this->show($id); } }