/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($id = null) { if ($id == null) { return Products::orderBy('id', 'asc')->get(); } else { return $this->show($id); } }