Update (admin): Add delete post forever
This commit is contained in:
@@ -37,6 +37,21 @@ public function edit(Request $request, $post_id)
|
||||
return redirect()->back()->with('error', 'Post does not exist.');
|
||||
}
|
||||
|
||||
public function delete(Request $request, $post_id)
|
||||
{
|
||||
$post = Post::find($post_id);
|
||||
|
||||
if (! is_null($post)) {
|
||||
|
||||
$post_categories = PostCategory::where('post_id', $post->id)->delete();
|
||||
$post->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Post deleted.');
|
||||
|
||||
}
|
||||
|
||||
return redirect()->back()->with('error', 'Post does not exist.');
|
||||
}
|
||||
public function indexing(Request $request, $post_id)
|
||||
{
|
||||
$post = Post::find($post_id);
|
||||
|
||||
Reference in New Issue
Block a user