mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-09 21:42:57 +00:00
31 lines
564 B
PHP
31 lines
564 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Comment;
|
|
use App\Models\Post;
|
|
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");
|
|
}
|
|
|
|
public function deletePost(Post $post)
|
|
{
|
|
$post->featured = null;
|
|
$post->save();
|
|
$post->delete();
|
|
return redirect()->route('posts.home');
|
|
}
|
|
}
|