blob: 1aba50568c479f9ff3a16a3fc03fa002d8fb2313 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?php
namespace App\Http\Controllers;
use Auth;
use Illuminate\Foundation\Auth\User;
class AdminController extends Controller
{
public function Overview()
{
$this->checkAdmin();
return view('admin.overview', ['user' => Auth::user()]);
}
private function checkAdmin()
{
$isAdmin = User::findOrFail(Auth::user()->id)->admin;
if ($isAdmin !== 1) {
abort(403, 'Sorry, you are not an administrator.');
}
return true;
}
}
|