<?php

namespace App\Http\Controllers\Backend;

use App\DataTables\Roles\RoleDataTable;
use App\DataTables\Roles\RoleDataTableEditor;
use App\Http\Controllers\Controller;


class RoleController extends Controller{
    protected $dirLogs = "roles";

    public function __construct(){

        $this->middleware('permission:role-list')
            ->only(["index"]);

        $this->middleware('permission:role-show')
            ->only(["show"]);

        $this->middleware(['permission:role-create','permission:role-update','permission:role-delete'])
            ->only(['dtEdit']);
    }

    public function index(RoleDataTable $dataTable){
        $title = __("Manage Roles");
        return $dataTable->render('backend.roles.index',compact("title"));
    }

    public function dtEdit(RoleDataTableEditor $editor){
        return $editor->process(request());
    }


}
