public function create($id = null) { $this->layout = 'content.create'; $this->metas['title'] = "Агуулга нэмэх"; if ($id != null) { $this->metas['title'] = "Агуулга засах"; } $this->appendScriptStyle(); $this->view = $this->BuildLayout(); $this->view->withUser($this->user)->withCategories(Category::getCategoryOptions(2))->withContentTypeOptions(ContentType::getContentTypeOptions()); if ($id != null) { $content = Content::find($id); $this->view->withContent($content); } return $this->view; }
public function edit($id) { $this->appendScriptStyle(); $project = Project::where('id', $id); $status = null; $edit = false; if ($project->exists()) { $project = $project->first(); if ($this->user->id == $project->user_id) { $this->metas['title'] = $project->title; $this->layout = 'project.edit'; } else { $this->metas['title'] = 'Хандах эрхгүй'; $this->layout = 'errors.403'; $status = "Танд уг төслийг засах эрх байхгүй байна"; } } else { $this->metas['title'] = 'Төсөл олдсонгүй'; $this->layout = 'errors.404'; $status = "Таны хайсан төсөл олдсонгүй"; $project = null; } $this->view = $this->BuildLayout(); return $this->view->withCategories(Category::getCategoryOptions(1))->withStatus($status)->withEdit($edit)->withProject($project); }