fix isAdmin

This commit is contained in:
Alexander Yakovlev 2022-08-10 10:21:22 +07:00
parent 5a7a0f2138
commit 5d32e10905
Signed by: oreolek
GPG key ID: 8D24103F5EE2A6C0
2 changed files with 2 additions and 10 deletions

View file

@ -3,6 +3,7 @@ namespace App\Http\View;
use Illuminate\Support\Facades\Auth;
use App\Helpers\Markdown;
use App\Models\User;
class GenericView {
/**
@ -24,7 +25,7 @@ class GenericView {
public function __construct(
) {
// Check if logged in
$this->is_admin = !is_null(Auth::user());
$this->is_admin = !is_null(Auth::user()) && Auth::user()->role === User::ROLE_ADMIN;
$this->markdown = new Markdown();
}
@ -65,10 +66,6 @@ class GenericView {
'text' => 'Черновики страниц',
'link' => 'page/drafts',
],
[
'text' => 'Заметки',
'link' => 'note/index',
],
));
$drop_links['Черновики дневника'] = 'post/drafts';
}

View file

@ -11,11 +11,6 @@ use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Support\Facades\Route;
Route::middleware('guest')->group(function () {
Route::get('register', [RegisteredUserController::class, 'create'])
->name('register');
Route::post('register', [RegisteredUserController::class, 'store']);
Route::get('login', [AuthenticatedSessionController::class, 'create'])
->name('login');