@@ 196-215 (lines=20) @@ | ||
193 | * @param int $id |
|
194 | * @return View |
|
195 | */ |
|
196 | public function getModalDelete($id = null) |
|
197 | { |
|
198 | $confirm_route = $error = null; |
|
199 | ||
200 | $title = 'Delete category'; |
|
201 | $message = 'Are you sure to delete this category?'; |
|
202 | ||
203 | // Get category information |
|
204 | $cat = Blog::getCategoriesRepository()->findOrFail($id); |
|
205 | ||
206 | if ($cat == null) |
|
207 | { |
|
208 | // Prepare the error message |
|
209 | $error = Lang::get('blog.category.not_found'); |
|
210 | return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route')); |
|
211 | } |
|
212 | ||
213 | $confirm_route = route('delete/category', ['id' => $cat->id]); |
|
214 | return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route')); |
|
215 | } |
|
216 | ||
217 | /** |
|
218 | * Delete the given category. |
@@ 230-249 (lines=20) @@ | ||
227 | * @param int $id |
|
228 | * @return View |
|
229 | */ |
|
230 | public function getModalDelete($id = null) |
|
231 | { |
|
232 | $confirm_route = $error = null; |
|
233 | ||
234 | $title = 'Delete post'; |
|
235 | $message = 'Are you sure to delete this post?'; |
|
236 | ||
237 | // Get post information |
|
238 | $post = Blog::getPostsRepository()->findOrFail($id); |
|
239 | ||
240 | if ($post == null) |
|
241 | { |
|
242 | // Prepare the error message |
|
243 | $error = Lang::get('blog.posts.not_found'); |
|
244 | return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route')); |
|
245 | } |
|
246 | ||
247 | $confirm_route = route('delete/post', ['id' => $post->id]); |
|
248 | return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route')); |
|
249 | } |
|
250 | ||
251 | /** |
|
252 | * Delete the given post. |