<?php
namespace App\Controllers;

require_once BASE_PATH . '/app/helpers/permissions.php';
use App\Core\Controller;
use App\Core\Database;

class AdminCommentController extends Controller
{
    public function add(): void
    {
        $db = Database::getInstance();
        $db->prepare("
            INSERT INTO editorial_comments(submission_id,user_id,comment)
            VALUES (?,?,?)
        ")->execute([
            $_POST['submission_id'],
            $_SESSION['user']['id'],
            $_POST['comment']
        ]);

        header("Location: ".base_path('admin/submissions'));
        exit;
    }
}
