1 | <?php namespace Modules\Blog\Http\Controllers\Admin; |
||
9 | class CategoryController extends AdminBaseController |
||
10 | { |
||
11 | /** |
||
12 | * @var CategoryRepository |
||
13 | */ |
||
14 | private $category; |
||
15 | |||
16 | public function __construct(CategoryRepository $category) |
||
17 | { |
||
18 | parent::__construct(); |
||
19 | |||
20 | $this->category = $category; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Display a listing of the resource. |
||
25 | * |
||
26 | * @return Response |
||
27 | */ |
||
28 | public function index() |
||
29 | { |
||
30 | $categories = $this->category->all(); |
||
31 | |||
32 | return view('blog::admin.categories.index', compact('categories')); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Show the form for creating a new resource. |
||
37 | * |
||
38 | * @return Response |
||
39 | */ |
||
40 | public function create() |
||
44 | |||
45 | /** |
||
46 | * Store a newly created resource in storage. |
||
47 | * |
||
48 | * @param StoreCategoryRequest $request |
||
49 | * @return Response |
||
50 | */ |
||
51 | public function store(StoreCategoryRequest $request) |
||
52 | { |
||
53 | $this->category->create($request->all()); |
||
54 | |||
55 | flash(trans('blog::messages.category created')); |
||
56 | |||
57 | return redirect()->route('admin.blog.category.index'); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Show the form for editing the specified resource. |
||
62 | * |
||
63 | * @param Category $category |
||
64 | * @return Response |
||
65 | */ |
||
66 | public function edit(Category $category) |
||
70 | |||
71 | /** |
||
72 | * Update the specified resource in storage. |
||
73 | * |
||
74 | * @param Category $category |
||
75 | * @param UpdateCategoryRequest $request |
||
76 | * @return Response |
||
77 | */ |
||
78 | public function update(Category $category, UpdateCategoryRequest $request) |
||
86 | |||
87 | /** |
||
88 | * Remove the specified resource from storage. |
||
89 | * |
||
90 | * @param Category $category |
||
91 | * @return Response |
||
92 | */ |
||
93 | public function destroy(Category $category) |
||
101 | } |
||
102 |