<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, ValidatesRequests;

    protected array $css = [
        "bootstrap_old.min.css",
        "bootstrap-theme.min.css",
        "common.css",
        "main.css"
    ];

    protected array $js = [
        "functions.js",
        "jquery-1.12.4.min.js",
        "bootstrap_old.min.js"
    ];

    protected function addJsFile(string $js): void
    {
        $this->js[] = $js;
    }

    protected function addCssFile(string $css): void
    {
        $this->css[] = $css;
    }

    protected function render(string $view, array $data = [])
    {
        $menu = config("menu");
        $css_files = $this->css;
        $js_files = $this->js;

        return view($view,
            compact('menu'),
            compact(['css_files', 'js_files']),
            compact('data')
        );
    }
}
