fix isAdmin
This commit is contained in:
parent
5a7a0f2138
commit
5d32e10905
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
Loading…
Reference in a new issue