<?php

namespace App\Http\Controllers;

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

use Psy\Readline\Hoa\Console;

class AdminController extends Controller
{
    public function true($id)
    {
        $state = Statement::where('id', $id)->first();
        $state->status = "Принято";
        $state->save();
        return redirect()->route('adminpanel');
    }

    public function false($id)
    {
        $state = Statement::where('id', $id)->first();
        $state->status = "Отклонено";
        $state->save();
        return redirect()->route('adminpanel');
    }

    public function adminpanel()
    {
        $allstates = Statement::all();
        return view('adminpanel', ['allstates' => $allstates]);
    }

}
