コード例 #1
0
 public function delete(Request $request, $id)
 {
     $category = Category::findOrFail($id);
     $title = $category->title;
     $category->delete();
     return redirect()->route('admin.post.category.index')->with('messages', ['Category ' . $title . ' is successfully deleted.']);
 }
コード例 #2
0
ファイル: PageController.php プロジェクト: yohanes1989/goprop
 public function resourcePost($slug)
 {
     $qb = PostTranslation::with('post')->whereSlug($slug);
     $postTranslation = $qb->firstOrFail();
     $post = $postTranslation->post()->published()->firstOrFail();
     $title = $post->title;
     $categories = Category::with(['translations', 'postsCount'])->get();
     return view('frontend.page.resources.post', ['post' => $post, 'categories' => $categories, 'title' => $title]);
 }
コード例 #3
0
ファイル: PostController.php プロジェクト: yohanes1989/goprop
 protected function getCategoryOptions($lang)
 {
     $categories = Category::all();
     $categoryOptions = [];
     foreach ($categories as $category) {
         $translation = $category->translate($lang, true);
         $categoryOptions[$category->id] = $translation->title;
     }
     return $categoryOptions;
 }
コード例 #4
0
 public function resourceCategories()
 {
     $categories = Category::all();
     $content = view('frontend.sitemap.resource_categories', ['categories' => $categories])->render();
     return response($content, 200)->header('Content-Type', 'text/xml');
 }