<?php

namespace App\Http\Controllers;

use App\Models\Entry;
use Illuminate\Http\Request;

class RedirectController extends Controller
{
    public function entryReportRedirect( Request $request )
    {
        $id = $request->input('id');
        $entry = Entry::findOrFail($id);

        return redirect()->route('entries.show', ['section' => $entry->type, 'entry' => $entry])->with('success', "Your report has been sent.");
    }

    public function newsReportRedirect( Request $request )
    {
        $id = $request->input('id');
        $entry = News::findOrFail($id);

        return redirect()->route('news.show', ['news' => $entry])->with('success', "Your report has been sent.");
    }

}
