Black Friday Sale

Wisnu A. Wiyangga

Joined 21 December, 2021
2
Comments
61
Total experiences
2
Lesson completed

Last activity

Role & Permission with Admin PanelPeriksa yang punya peran12:25

Wisnu A. Wiyangga replied to Wisnu A. Wiyangga comment.

ada yang kurang, asign role di database , oke terimakasih tidak jadi hhe

Role & Permission with Admin PanelPeriksa yang punya peran12:25

Wisnu A. Wiyangga

bang tanya dong, kenapa fungsi hasanyrole / hasrole , saya ga jalan ya, menu navigation terhidden walaupun sudah saya login dengan user terautentifikasi sekalipun superadmin, menu navigation tetap tidak muncul

model/user.php use Spatie\Permission\Traits\HasRoles; use Illuminate\Notifications\Notifiable;

class User extends Authenticatable { use HasApiTokens; use HasFactory; use HasProfilePhoto; use Notifiable; use TwoFactorAuthenticatable; use HasRoles;

app/view/layouts/navigation.php namespace App\View\Components\layouts; use Illuminate\View\Component; use Spatie\Permission\Models\Role;

public function render() { $roles = Role::get(); return view('components.layouts.navigation', compact('roles')); }

resource/views/component/layouts/navigation.blade.php

@hasrole('SuperAdmin')

@endhasrole