/** * check if input exist then prepare the relation object and assign it to the array * * @param $relations * * @return array */ public function writerRelations($relations) { $result = []; if (isset($relations['writer'])) { $result = ['writer' => $this->writers->findBy('id', $relations['writer'])]; } return $result; }
/** * Show the form for editing the specified resource. * * @param $idOrSlug * * @return Response */ public function edit($idOrSlug) { if (!Auth::hasPermission("update")) { return Redirect::back(); } // get the news article $news = $this->news_service->findByIdOrSlug($idOrSlug); // get all writers $writers = $this->writers->all(); // get timezones $timezones = Helper::getTimezones(); return View::make("cms.pages.news.edit")->with('section', $this->section)->with('writers', $writers)->with('timezones', $timezones)->with('updating', true)->with('errors', Input::get('errors') ? Input::get('errors') : null)->with('edit_news', $news)->with('limited_editing', $this->content_service->isLimitedEditing($news)); }