/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $name = Input::get('data'); if ($name == 'lesson') { $data = Person::find($id)->lesson; } elseif ($name == 'seminar') { $data = Lessons::find($id)->seminar; } return response()->json($data); }
/** * @param Menu $menuModel * @param Slider $slider * @param Alphabet $alphabet * @param Song $song * @param Performer $performer * @param Lessons $lessons * @param Request $request */ public function __construct(Menu $menuModel, Slider $slider, Alphabet $alphabet, Song $song, Performer $performer, Lessons $lessons, Request $request) { $this->performer = $performer; #Models performer $this->song = $song; #Models song $this->lessons = $lessons; #Models lessons $this->request = $request; #request $this->data['menu']['left'] = $menuModel->getLeftMenu(); $this->data['menu']['right'] = $menuModel->getRightMenu(); $this->data['slider'] = $slider->getActive(); $this->data['alphabet'] = $alphabet->getActive(); $this->data['countPerformer'] = count($performer->getActive()); $this->data['countSong'] = count($song->getActive()); $this->data['countLessons'] = count($lessons->getAll()); $URL = $_SERVER['REQUEST_URI']; $this->data['url_lang'] = substr($URL, 1, 2); }