mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-10 05:42:58 +00:00
update
This commit is contained in:
parent
afc1fb10bc
commit
8004c8d69e
12 changed files with 320 additions and 5 deletions
22
app/Http/Controllers/DeletionController.php
Normal file
22
app/Http/Controllers/DeletionController.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DeletionController extends Controller
|
||||
{
|
||||
public function deleteComment(Comment $comment)
|
||||
{
|
||||
if (Auth::id() != $comment->user->id)
|
||||
{
|
||||
abort(401);
|
||||
}
|
||||
|
||||
$postid = $comment->post->id;
|
||||
$comment->delete();
|
||||
return redirect("/posts/$postid");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue