добавлена кнопка удаления новости
This commit is contained in:
parent
d40abee083
commit
43cabbc7ea
@ -114,6 +114,6 @@ public function update(Request $request, Post $post)
|
|||||||
public function delete(Post $post)
|
public function delete(Post $post)
|
||||||
{
|
{
|
||||||
$post->delete();
|
$post->delete();
|
||||||
return to_route('admin.posts');
|
return back()->withSuccess('Новость удалена успешно');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,11 +21,17 @@
|
|||||||
@endif
|
@endif
|
||||||
<div class="mt-2 d-flex justify-content-between align-items-center">
|
<div class="mt-2 d-flex justify-content-between align-items-center">
|
||||||
<h1 class="flex-fill">{{ $post->name }}</h1>
|
<h1 class="flex-fill">{{ $post->name }}</h1>
|
||||||
|
<div class="ms-auto hstack gap-2">
|
||||||
@can('update', $post)
|
@can('update', $post)
|
||||||
<div class="ms-auto">
|
|
||||||
@livewire('post.form', ['post' => $post])
|
@livewire('post.form', ['post' => $post])
|
||||||
</div>
|
|
||||||
@endcan
|
@endcan
|
||||||
|
@can('delete', $post)
|
||||||
|
<form action="{{ route('admin.posts.delete', $post) }}" method="POST" onsubmit="return confirm('Вы уверены?')">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="btn btn-danger"><i class="bi bi-x-lg"></i></button>
|
||||||
|
</form>
|
||||||
|
@endcan
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{!! $post->trixRender('content') !!}
|
{!! $post->trixRender('content') !!}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user