Testing Gate Otorisasi

Login sebagai: {{ $currentUser->name }} ({{ $currentUser->role?->name }})

Hasil Cek Otorisasi:

Update artikel MILIK SENDIRI: @if($canUpdateMyPost) ✅ YA @else ❌ TIDAK @endif

Artikel dengan author_id = {{ $currentUser->id }} (sama dengan user login)

Update artikel MILIK ORANG LAIN: @if($canUpdateOtherPost) ✅ YA @else ❌ TIDAK @endif

Artikel dengan author_id = user lain (bukan milik sendiri)

Hapus artikel (sembarang): @if($canDelete) ✅ YA @else ❌ TIDAK @endif

💡 Aturan Gate:

  • Admin → bisa update & hapus semua artikel
  • Editor → bisa update semua artikel (tidak bisa hapus)
  • Writer → bisa update artikel milik sendiri saja (tidak bisa hapus)
  • Reader → tidak bisa update atau hapus