1 | <?php namespace Modules\Page\Http\Controllers\Admin; |
||
9 | class PageController extends AdminBaseController |
||
10 | { |
||
11 | /** |
||
12 | * @var PageRepository |
||
13 | */ |
||
14 | private $page; |
||
15 | |||
16 | public function __construct(PageRepository $page) |
||
23 | |||
24 | public function index() |
||
30 | |||
31 | /** |
||
32 | * Show the form for creating a new resource. |
||
33 | * |
||
34 | * @return Response |
||
35 | */ |
||
36 | public function create() |
||
42 | |||
43 | /** |
||
44 | * Store a newly created resource in storage. |
||
45 | * |
||
46 | * @param CreatePageRequest $request |
||
47 | * @return Response |
||
48 | */ |
||
49 | public function store(CreatePageRequest $request) |
||
50 | { |
||
51 | $this->page->create($request->all()); |
||
52 | |||
53 | flash(trans('page::messages.page created')); |
||
54 | |||
55 | return redirect()->route('admin.page.page.index'); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Show the form for editing the specified resource. |
||
60 | * |
||
61 | * @param Page $page |
||
62 | * @return Response |
||
63 | */ |
||
64 | public function edit(Page $page) |
||
70 | |||
71 | /** |
||
72 | * Update the specified resource in storage. |
||
73 | * |
||
74 | * @param Page $page |
||
75 | * @param UpdatePageRequest $request |
||
76 | * @return Response |
||
77 | */ |
||
78 | public function update(Page $page, UpdatePageRequest $request) |
||
79 | { |
||
80 | $this->page->update($page, $request->all()); |
||
81 | |||
82 | flash(trans('page::messages.page updated')); |
||
83 | |||
84 | if ($request->get('button') === 'index') { |
||
85 | return redirect()->route('admin.page.page.index'); |
||
86 | } |
||
87 | |||
88 | return redirect()->back(); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Remove the specified resource from storage. |
||
93 | * |
||
94 | * @param Page $page |
||
95 | * @return Response |
||
96 | */ |
||
97 | public function destroy(Page $page) |
||
105 | } |
||
106 |