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.');
|
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)
|
public function indexing(Request $request, $post_id)
|
||||||
{
|
{
|
||||||
$post = Post::find($post_id);
|
$post = Post::find($post_id);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<div class="text-muted">
|
<div class="text-muted">
|
||||||
<p class="fw-bold mb-0">Change Log 2/8/2023 12.03am</p>
|
<p class="fw-bold mb-0">Change Log 2/8/2023 12.03am</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>(Feature) Add Delete Forever button</li>
|
||||||
<li>(Feature) Add Index to Search Engines button</li>
|
<li>(Feature) Add Index to Search Engines button</li>
|
||||||
<li>(Feature) Auto set author on new post</li>
|
<li>(Feature) Auto set author on new post</li>
|
||||||
<li>(Feature) Only publish status must fill in all post fields, others status can save with minimum title and
|
<li>(Feature) Only publish status must fill in all post fields, others status can save with minimum title and
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ class="img-fluid rounded-2" alt=""></td>
|
|||||||
class="btn">Index to Search Engines</a>
|
class="btn">Index to Search Engines</a>
|
||||||
<a href="{{ route('posts.manage.edit', ['post_id' => $post->id]) }}"
|
<a href="{{ route('posts.manage.edit', ['post_id' => $post->id]) }}"
|
||||||
class="btn">Edit</a>
|
class="btn">Edit</a>
|
||||||
|
<a href="{{ route('posts.manage.delete', ['post_id' => $post->id]) }}"
|
||||||
|
class="btn">Delete Forever</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<div class="page" id="app">
|
<div class="page" id="app">
|
||||||
<div class="sticky-top">
|
<div class="sticky-top">
|
||||||
|
|
||||||
@include('admin.partials.flash_messages')
|
|
||||||
|
|
||||||
@include('layouts.admin.header')
|
@include('layouts.admin.header')
|
||||||
|
|
||||||
@@ -30,6 +30,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
|
|
||||||
|
<div class="container-xl">
|
||||||
|
|
||||||
|
@include('admin.partials.flash_messages')
|
||||||
|
</div>
|
||||||
|
|
||||||
@yield('content')
|
@yield('content')
|
||||||
|
|
||||||
@include('layouts.admin.footer')
|
@include('layouts.admin.footer')
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
Route::get('posts/edit/{post_id}', [\App\Http\Controllers\Admin\PostController::class, 'edit'])->name('posts.manage.edit');
|
Route::get('posts/edit/{post_id}', [\App\Http\Controllers\Admin\PostController::class, 'edit'])->name('posts.manage.edit');
|
||||||
|
|
||||||
|
Route::get('posts/delete/{post_id}', [\App\Http\Controllers\Admin\PostController::class, 'delete'])->name('posts.manage.delete');
|
||||||
|
|
||||||
Route::get('posts/indexing/{post_id}', [\App\Http\Controllers\Admin\PostController::class, 'indexing'])->name('posts.manage.indexing');
|
Route::get('posts/indexing/{post_id}', [\App\Http\Controllers\Admin\PostController::class, 'indexing'])->name('posts.manage.indexing');
|
||||||
|
|
||||||
Route::get('posts/new', [\App\Http\Controllers\Admin\PostController::class, 'new'])->name('posts.manage.new');
|
Route::get('posts/new', [\App\Http\Controllers\Admin\PostController::class, 'new'])->name('posts.manage.new');
|
||||||
|
|||||||
Reference in New Issue
Block a user