<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Category;
use App\User;
use GuzzleHttp\Psr7\Request;
use Illuminate\Support\Facades\Gate;

class UsersAdminController extends Controller
{

    public function index()
    {

        if (Gate::denies('is-admin')) {
            return redirect('/')->with(['errors' => 'У вас не достаточно полномочий']);
        }

        $users = User::with('role')->paginate(15);

        return view('admin.users', ['users' => $users]);
    }

}
