<?php
namespace App\Core;

class AdminBaseController extends Controller
{
    /*
    Override render to use admin layout
    */

    public function render($view, $data = [])
    {
        extract($data);

        $viewFile =
            BASE_PATH .
            '/app/views/' .
            $view .
            '.php';

        if (!file_exists($viewFile)) {

            die(
                "View not found: "
                . $viewFile
            );

        }

        ob_start();

        require $viewFile;

        $content =
            ob_get_clean();

        require
            BASE_PATH .
            '/app/views/layouts/admin_layout.php';
    }
}
