This commit is contained in:
yuriko 🦊 2025-05-24 17:01:54 -04:00
parent afc1fb10bc
commit 8004c8d69e
Signed by: jaiden
SSH key fingerprint: SHA256:f8tvveBoXBrKZIQDWLLcpQrKbATUCGg98x2N4YzkDM8
12 changed files with 320 additions and 5 deletions

View 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");
}
}