1 | <?php namespace Arcanesoft\Blog\Http\Controllers\Admin; |
||
17 | class PostsController extends Controller |
||
18 | { |
||
19 | /* ------------------------------------------------------------------------------------------------ |
||
20 | | Properties |
||
21 | | ------------------------------------------------------------------------------------------------ |
||
22 | */ |
||
23 | /** |
||
24 | * The post model. |
||
25 | * |
||
26 | * @var \Arcanesoft\Blog\Models\Post |
||
27 | */ |
||
28 | private $post; |
||
29 | |||
30 | /* ------------------------------------------------------------------------------------------------ |
||
31 | | Constructor |
||
32 | | ------------------------------------------------------------------------------------------------ |
||
33 | */ |
||
34 | /** |
||
35 | * Instantiate the controller. |
||
36 | * |
||
37 | * @param Post $post |
||
38 | */ |
||
39 | public function __construct(Post $post) |
||
48 | |||
49 | /* ------------------------------------------------------------------------------------------------ |
||
50 | | Main Functions |
||
51 | | ------------------------------------------------------------------------------------------------ |
||
52 | */ |
||
53 | /** |
||
54 | * List the posts. |
||
55 | * |
||
56 | * @param bool $trashed |
||
57 | * |
||
58 | * @return \Illuminate\View\View |
||
59 | */ |
||
60 | public function index($trashed = false) |
||
74 | |||
75 | /** |
||
76 | * List the trashed posts. |
||
77 | * |
||
78 | * @return \Illuminate\View\View |
||
79 | */ |
||
80 | public function trash() |
||
84 | |||
85 | /** |
||
86 | * Create a post. |
||
87 | * |
||
88 | * @return \Illuminate\View\View |
||
89 | */ |
||
90 | public function create() |
||
103 | |||
104 | /** |
||
105 | * Store the post. |
||
106 | * |
||
107 | * @param \Arcanesoft\Blog\Http\Requests\Admin\Posts\CreatePostRequest $request |
||
108 | * @param \Arcanesoft\Blog\Models\Post $post |
||
109 | * |
||
110 | * @return \Illuminate\Http\RedirectResponse |
||
111 | */ |
||
112 | public function store(CreatePostRequest $request, Post $post) |
||
124 | |||
125 | /** |
||
126 | * Show a post. |
||
127 | * |
||
128 | * @param \Arcanesoft\Blog\Models\Post $post |
||
129 | * |
||
130 | * @return \Illuminate\View\View |
||
131 | */ |
||
132 | public function show(Post $post) |
||
143 | |||
144 | /** |
||
145 | * Edit a post. |
||
146 | * |
||
147 | * @param \Arcanesoft\Blog\Models\Post $post |
||
148 | * |
||
149 | * @return \Illuminate\View\View |
||
150 | */ |
||
151 | public function edit(Post $post) |
||
164 | |||
165 | public function update(UpdatePostRequest $request, Post $post) |
||
177 | |||
178 | public function publish(Post $post) |
||
182 | |||
183 | public function restore(Post $post) |
||
187 | |||
188 | public function delete(Post $post) |
||
192 | } |
||
193 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: