diff --git a/app/Enums/UserRole.php b/app/Enums/UserRole.php
new file mode 100644
index 0000000..100ee94
--- /dev/null
+++ b/app/Enums/UserRole.php
@@ -0,0 +1,17 @@
+label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit', [
- 'id' => $row->id,
- 'editRoute' => route('studio.catalog.bottle.edit', $row->id),
- ])->render();
+ if (auth()->user()->can('update bottle')) {
+ $actions .= view('components.datatables.edit', [
+ 'id' => $row->id,
+ 'editRoute' => route('studio.catalog.bottle.edit', $row->id),
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.catalog.bottle.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete bottle')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.catalog.bottle.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Catalog/BrandsTable.php b/app/Livewire/Datatable/Studio/Catalog/BrandsTable.php
index 4487213..95bcf1f 100644
--- a/app/Livewire/Datatable/Studio/Catalog/BrandsTable.php
+++ b/app/Livewire/Datatable/Studio/Catalog/BrandsTable.php
@@ -34,57 +34,63 @@ public function columns(): array
$actions = '';
$maxSortOrder = Brand::max('sort_order');
- if ($row->sort_order > 1) {
- $actions .= view('components.datatables.sort-button', [
- 'id' => $row->id,
- 'module' => 'brand',
- 'direction' => 'up',
- 'tooltip' => 'Naik',
- 'color' => 'cyan',
- 'icon' => 'arrow-up',
- ])->render();
+ if (auth()->user()->can('update brand')) {
+ if ($row->sort_order > 1) {
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'brand',
+ 'direction' => 'up',
+ 'tooltip' => 'Naik',
+ 'color' => 'cyan',
+ 'icon' => 'arrow-up',
+ ])->render();
- $actions .= view('components.datatables.sort-button', [
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'brand',
+ 'direction' => 'first',
+ 'tooltip' => 'Pertama',
+ 'color' => 'emerald',
+ 'icon' => 'bars-arrow-up',
+ ])->render();
+ }
+
+ if ($row->sort_order < $maxSortOrder) {
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'brand',
+ 'direction' => 'down',
+ 'tooltip' => 'Turun',
+ 'color' => 'orange',
+ 'icon' => 'arrow-down',
+ ])->render();
+
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'brand',
+ 'direction' => 'last',
+ 'tooltip' => 'Terakhir',
+ 'color' => 'rose',
+ 'icon' => 'bars-arrow-down',
+ ])->render();
+ }
+ }
+
+ if (auth()->user()->can('update brand')) {
+ $actions .= view('components.datatables.edit-modal', [
'id' => $row->id,
- 'module' => 'brand',
- 'direction' => 'first',
- 'tooltip' => 'Pertama',
- 'color' => 'emerald',
- 'icon' => 'bars-arrow-up',
+ 'method' => 'update',
+ 'modalTitle' => 'Ubah Kategori',
])->render();
}
- if ($row->sort_order < $maxSortOrder) {
- $actions .= view('components.datatables.sort-button', [
+ if (auth()->user()->can('delete brand')) {
+ $actions .= view('components.datatables.delete', [
'id' => $row->id,
- 'module' => 'brand',
- 'direction' => 'down',
- 'tooltip' => 'Turun',
- 'color' => 'orange',
- 'icon' => 'arrow-down',
- ])->render();
-
- $actions .= view('components.datatables.sort-button', [
- 'id' => $row->id,
- 'module' => 'brand',
- 'direction' => 'last',
- 'tooltip' => 'Terakhir',
- 'color' => 'rose',
- 'icon' => 'bars-arrow-down',
+ 'deleteRoute' => route('studio.catalog.brand.delete', $row->id),
])->render();
}
- $actions .= view('components.datatables.edit-modal', [
- 'id' => $row->id,
- 'method' => 'update',
- 'modalTitle' => 'Ubah Kategori',
- ])->render();
-
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.catalog.brand.delete', $row->id),
- ])->render();
-
return $actions;
})
->html(),
diff --git a/app/Livewire/Datatable/Studio/Catalog/CategoriesTable.php b/app/Livewire/Datatable/Studio/Catalog/CategoriesTable.php
index 6bdcdad..299e14e 100644
--- a/app/Livewire/Datatable/Studio/Catalog/CategoriesTable.php
+++ b/app/Livewire/Datatable/Studio/Catalog/CategoriesTable.php
@@ -25,57 +25,63 @@ public function columns(): array
$actions = '';
$maxSortOrder = Category::max('sort_order');
- if ($row->sort_order > 1) {
- $actions .= view('components.datatables.sort-button', [
- 'id' => $row->id,
- 'module' => 'category',
- 'direction' => 'up',
- 'tooltip' => 'Naik',
- 'color' => 'cyan',
- 'icon' => 'arrow-up',
- ])->render();
+ if (auth()->user()->can('update category')) {
+ if ($row->sort_order > 1) {
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'category',
+ 'direction' => 'up',
+ 'tooltip' => 'Naik',
+ 'color' => 'cyan',
+ 'icon' => 'arrow-up',
+ ])->render();
- $actions .= view('components.datatables.sort-button', [
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'category',
+ 'direction' => 'first',
+ 'tooltip' => 'Pertama',
+ 'color' => 'emerald',
+ 'icon' => 'bars-arrow-up',
+ ])->render();
+ }
+
+ if ($row->sort_order < $maxSortOrder) {
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'category',
+ 'direction' => 'down',
+ 'tooltip' => 'Turun',
+ 'color' => 'orange',
+ 'icon' => 'arrow-down',
+ ])->render();
+
+ $actions .= view('components.datatables.sort-button', [
+ 'id' => $row->id,
+ 'module' => 'category',
+ 'direction' => 'last',
+ 'tooltip' => 'Terakhir',
+ 'color' => 'rose',
+ 'icon' => 'bars-arrow-down',
+ ])->render();
+ }
+ }
+
+ if (auth()->user()->can('update category')) {
+ $actions .= view('components.datatables.edit-modal', [
'id' => $row->id,
- 'module' => 'category',
- 'direction' => 'first',
- 'tooltip' => 'Pertama',
- 'color' => 'emerald',
- 'icon' => 'bars-arrow-up',
+ 'method' => 'update',
+ 'modalTitle' => 'Ubah Kategori',
])->render();
}
- if ($row->sort_order < $maxSortOrder) {
- $actions .= view('components.datatables.sort-button', [
+ if (auth()->user()->can('delete category')) {
+ $actions .= view('components.datatables.delete', [
'id' => $row->id,
- 'module' => 'category',
- 'direction' => 'down',
- 'tooltip' => 'Turun',
- 'color' => 'orange',
- 'icon' => 'arrow-down',
- ])->render();
-
- $actions .= view('components.datatables.sort-button', [
- 'id' => $row->id,
- 'module' => 'category',
- 'direction' => 'last',
- 'tooltip' => 'Terakhir',
- 'color' => 'rose',
- 'icon' => 'bars-arrow-down',
+ 'deleteRoute' => route('studio.catalog.category.delete', $row->id),
])->render();
}
- $actions .= view('components.datatables.edit-modal', [
- 'id' => $row->id,
- 'method' => 'update',
- 'modalTitle' => 'Ubah Kategori',
- ])->render();
-
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.catalog.category.delete', $row->id),
- ])->render();
-
return $actions;
})
->html(),
diff --git a/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php b/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php
index 2a4e5ba..60799b6 100644
--- a/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php
+++ b/app/Livewire/Datatable/Studio/Catalog/PerfumesTable.php
@@ -72,15 +72,19 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit', [
- 'id' => $row->id,
- 'editRoute' => route('studio.catalog.perfume.edit', $row->id),
- ])->render();
+ if (auth()->user()->can('update perfume')) {
+ $actions .= view('components.datatables.edit', [
+ 'id' => $row->id,
+ 'editRoute' => route('studio.catalog.perfume.edit', $row->id),
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.catalog.perfume.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete perfume')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.catalog.perfume.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Catalog/ProductsTable.php b/app/Livewire/Datatable/Studio/Catalog/ProductsTable.php
index d606370..0b45d44 100644
--- a/app/Livewire/Datatable/Studio/Catalog/ProductsTable.php
+++ b/app/Livewire/Datatable/Studio/Catalog/ProductsTable.php
@@ -55,15 +55,19 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit', [
- 'id' => $row->id,
- 'editRoute' => route('studio.catalog.product.edit', $row->id),
- ])->render();
+ if (auth()->user()->can('update product')) {
+ $actions .= view('components.datatables.edit', [
+ 'id' => $row->id,
+ 'editRoute' => route('studio.catalog.product.edit', $row->id),
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.catalog.product.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete product')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.catalog.product.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Finance/ExpensesTable.php b/app/Livewire/Datatable/Studio/Finance/ExpensesTable.php
index 7673c71..ab5ef6a 100644
--- a/app/Livewire/Datatable/Studio/Finance/ExpensesTable.php
+++ b/app/Livewire/Datatable/Studio/Finance/ExpensesTable.php
@@ -29,16 +29,20 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit-modal', [
- 'id' => $row->id,
- 'method' => 'update',
- 'modalTitle' => 'Ubah Kategori',
- ])->render();
+ if (auth()->user()->can('update expense')) {
+ $actions .= view('components.datatables.edit-modal', [
+ 'id' => $row->id,
+ 'method' => 'update',
+ 'modalTitle' => 'Ubah Kategori',
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.finance.expense.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete expense')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.finance.expense.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Loyalty/CustomersTable.php b/app/Livewire/Datatable/Studio/Loyalty/CustomersTable.php
index c73053d..14fe78b 100644
--- a/app/Livewire/Datatable/Studio/Loyalty/CustomersTable.php
+++ b/app/Livewire/Datatable/Studio/Loyalty/CustomersTable.php
@@ -36,16 +36,20 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit-modal', [
- 'id' => $row->id,
- 'method' => 'update',
- 'modalTitle' => 'Ubah Customer',
- ])->render();
+ if (auth()->user()->can('update customer')) {
+ $actions .= view('components.datatables.edit-modal', [
+ 'id' => $row->id,
+ 'method' => 'update',
+ 'modalTitle' => 'Ubah Customer',
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.loyalty.customer.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete customer')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.loyalty.customer.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Loyalty/TiersTable.php b/app/Livewire/Datatable/Studio/Loyalty/TiersTable.php
index 979468b..b324355 100644
--- a/app/Livewire/Datatable/Studio/Loyalty/TiersTable.php
+++ b/app/Livewire/Datatable/Studio/Loyalty/TiersTable.php
@@ -29,16 +29,20 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit-modal', [
- 'id' => $row->id,
- 'method' => 'update',
- 'modalTitle' => 'Ubah Tier',
- ])->render();
+ if (auth()->user()->can('update tier')) {
+ $actions .= view('components.datatables.edit-modal', [
+ 'id' => $row->id,
+ 'method' => 'update',
+ 'modalTitle' => 'Ubah Tier',
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.loyalty.tier.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete tier')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.loyalty.tier.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Loyalty/VouchersTable.php b/app/Livewire/Datatable/Studio/Loyalty/VouchersTable.php
index 3a311f5..03fcd93 100644
--- a/app/Livewire/Datatable/Studio/Loyalty/VouchersTable.php
+++ b/app/Livewire/Datatable/Studio/Loyalty/VouchersTable.php
@@ -93,15 +93,19 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit', [
- 'id' => $row->id,
- 'editRoute' => route('studio.loyalty.voucher.edit', $row->id),
- ])->render();
+ if (auth()->user()->can('update voucher')) {
+ $actions .= view('components.datatables.edit', [
+ 'id' => $row->id,
+ 'editRoute' => route('studio.loyalty.voucher.edit', $row->id),
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.loyalty.voucher.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete voucher')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.loyalty.voucher.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Master/OutletsTable.php b/app/Livewire/Datatable/Studio/Master/OutletsTable.php
index b9de82f..ce91791 100644
--- a/app/Livewire/Datatable/Studio/Master/OutletsTable.php
+++ b/app/Livewire/Datatable/Studio/Master/OutletsTable.php
@@ -104,15 +104,19 @@ public function columns(): array
->label(function ($row) {
$actions = '';
- $actions .= view('components.datatables.edit', [
- 'id' => $row->id,
- 'editRoute' => route('studio.master.outlet.edit', $row->id),
- ])->render();
+ if (auth()->user()->can('update outlet')) {
+ $actions .= view('components.datatables.edit', [
+ 'id' => $row->id,
+ 'editRoute' => route('studio.master.outlet.edit', $row->id),
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.master.outlet.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete outlet')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.master.outlet.delete', $row->id),
+ ])->render();
+ }
return $actions;
})
diff --git a/app/Livewire/Datatable/Studio/Master/UsersTable.php b/app/Livewire/Datatable/Studio/Master/UsersTable.php
index 40498cd..5a015c8 100644
--- a/app/Livewire/Datatable/Studio/Master/UsersTable.php
+++ b/app/Livewire/Datatable/Studio/Master/UsersTable.php
@@ -124,15 +124,19 @@ public function columns(): array
$actions = '';
if (auth()->id() !== $row?->user?->id) {
- $actions .= view('components.datatables.edit', [
- 'id' => $row->id,
- 'editRoute' => route('studio.master.user.edit', $row->id),
- ])->render();
+ if (auth()->user()->can('update user')) {
+ $actions .= view('components.datatables.edit', [
+ 'id' => $row->id,
+ 'editRoute' => route('studio.master.user.edit', $row->id),
+ ])->render();
+ }
- $actions .= view('components.datatables.delete', [
- 'id' => $row->id,
- 'deleteRoute' => route('studio.master.user.delete', $row->id),
- ])->render();
+ if (auth()->user()->can('delete user')) {
+ $actions .= view('components.datatables.delete', [
+ 'id' => $row->id,
+ 'deleteRoute' => route('studio.master.user.delete', $row->id),
+ ])->render();
+ }
}
return $actions;
diff --git a/app/Livewire/Studio/Catalog/Bottle/Create.php b/app/Livewire/Studio/Catalog/Bottle/Create.php
index f02a329..5b85788 100644
--- a/app/Livewire/Studio/Catalog/Bottle/Create.php
+++ b/app/Livewire/Studio/Catalog/Bottle/Create.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Catalog\BottleForm;
use App\Models\Outlet;
+use App\Traits\WithAuthorization;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
@@ -13,7 +14,7 @@
#[Title('Tambah Botol')]
class Create extends Component
{
- use WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
public BottleForm $form;
@@ -26,6 +27,8 @@ public function mount()
public function save()
{
+ $this->canOrAbort('create bottle');
+
$this->form->store();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Catalog/Bottle/Edit.php b/app/Livewire/Studio/Catalog/Bottle/Edit.php
index bb75718..242d555 100644
--- a/app/Livewire/Studio/Catalog/Bottle/Edit.php
+++ b/app/Livewire/Studio/Catalog/Bottle/Edit.php
@@ -29,6 +29,8 @@ public function mount(Bottle $bottle)
public function save()
{
+ $this->canOrAbort('update bottle');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Catalog/Brand.php b/app/Livewire/Studio/Catalog/Brand.php
index 6ddfcf6..a0c820d 100644
--- a/app/Livewire/Studio/Catalog/Brand.php
+++ b/app/Livewire/Studio/Catalog/Brand.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Catalog\BrandForm;
use App\Models\Brand as BrandModel;
+use App\Traits\WithAuthorization;
use App\Traits\WithCloseModal;
use App\Traits\WithConfirmation;
use App\Traits\WithToast;
@@ -16,7 +17,7 @@
#[Title('Merek')]
class Brand extends Component
{
- use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
public BrandForm $form;
@@ -40,6 +41,8 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
public function create()
{
+ $this->canOrAbort('create brand');
+
$this->form->store();
$this->dispatch('refreshDatatable');
@@ -51,6 +54,8 @@ public function create()
public function update()
{
+ $this->canOrAbort('update brand');
+
$this->form->update();
$this->dispatch('refreshDatatable');
@@ -76,6 +81,8 @@ public function delete(BrandModel $brand)
#[On('fn:sortOrder')]
public function sortOrder(BrandModel $brand, string $direction)
{
+ $this->canOrAbort('update brand');
+
$this->form->brand = $brand;
$this->form->sortOrder($direction);
diff --git a/app/Livewire/Studio/Catalog/Category.php b/app/Livewire/Studio/Catalog/Category.php
index f6ffa26..799aebe 100644
--- a/app/Livewire/Studio/Catalog/Category.php
+++ b/app/Livewire/Studio/Catalog/Category.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Catalog\CategoryForm;
use App\Models\Category as CategoryModel;
+use App\Traits\WithAuthorization;
use App\Traits\WithCloseModal;
use App\Traits\WithConfirmation;
use App\Traits\WithToast;
@@ -16,7 +17,7 @@
#[Title('Kategori')]
class Category extends Component
{
- use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
public CategoryForm $form;
@@ -40,6 +41,8 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
public function create()
{
+ $this->canOrAbort('create category');
+
$this->form->store();
$this->dispatch('refreshDatatable');
@@ -51,6 +54,8 @@ public function create()
public function update()
{
+ $this->canOrAbort('update category');
+
$this->form->update();
$this->dispatch('refreshDatatable');
@@ -76,6 +81,8 @@ public function delete(CategoryModel $category)
#[On('fn:sortOrder')]
public function sortOrder(CategoryModel $category, string $direction)
{
+ $this->canOrAbort('update category');
+
$this->form->category = $category;
$this->form->sortOrder($direction);
diff --git a/app/Livewire/Studio/Catalog/Perfume/Create.php b/app/Livewire/Studio/Catalog/Perfume/Create.php
index 867aac7..697b37c 100644
--- a/app/Livewire/Studio/Catalog/Perfume/Create.php
+++ b/app/Livewire/Studio/Catalog/Perfume/Create.php
@@ -6,6 +6,7 @@
use App\Models\Brand;
use App\Models\Category;
use App\Models\Outlet;
+use App\Traits\WithAuthorization;
use App\Traits\WithCategorySelector;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
@@ -16,7 +17,7 @@
#[Title('Tambah Parfum')]
class Create extends Component
{
- use WithCategorySelector, WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCategorySelector, WithOutletSelector, WithToast, WithUpdatedData;
public PerfumeForm $form;
@@ -37,6 +38,8 @@ public function mount()
public function save()
{
+ $this->canOrAbort('create perfume');
+
$this->form->store();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Catalog/Perfume/Edit.php b/app/Livewire/Studio/Catalog/Perfume/Edit.php
index 4e731d9..a940e8d 100644
--- a/app/Livewire/Studio/Catalog/Perfume/Edit.php
+++ b/app/Livewire/Studio/Catalog/Perfume/Edit.php
@@ -7,6 +7,7 @@
use App\Models\Category;
use App\Models\Outlet;
use App\Models\Perfume;
+use App\Traits\WithAuthorization;
use App\Traits\WithCategorySelector;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
@@ -17,7 +18,7 @@
#[Title('Ubah Parfum')]
class Edit extends Component
{
- use WithCategorySelector, WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCategorySelector, WithOutletSelector, WithToast, WithUpdatedData;
public PerfumeForm $form;
@@ -40,6 +41,8 @@ public function mount(Perfume $perfume)
public function save()
{
+ $this->canOrAbort('update perfume');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Catalog/Product/Create.php b/app/Livewire/Studio/Catalog/Product/Create.php
index 35576fc..670eafa 100644
--- a/app/Livewire/Studio/Catalog/Product/Create.php
+++ b/app/Livewire/Studio/Catalog/Product/Create.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Catalog\ProductForm;
use App\Models\Outlet;
+use App\Traits\WithAuthorization;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
@@ -13,7 +14,7 @@
#[Title('Tambah Produk')]
class Create extends Component
{
- use WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
public ProductForm $form;
@@ -26,6 +27,8 @@ public function mount()
public function save()
{
+ $this->canOrAbort('create product');
+
$this->form->store();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Catalog/Product/Edit.php b/app/Livewire/Studio/Catalog/Product/Edit.php
index 5f3a251..a07fa8d 100644
--- a/app/Livewire/Studio/Catalog/Product/Edit.php
+++ b/app/Livewire/Studio/Catalog/Product/Edit.php
@@ -5,6 +5,7 @@
use App\Livewire\Forms\Studio\Catalog\ProductForm;
use App\Models\Outlet;
use App\Models\Product;
+use App\Traits\WithAuthorization;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
@@ -14,7 +15,7 @@
#[Title('Ubah Produk')]
class Edit extends Component
{
- use WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
public ProductForm $form;
@@ -29,6 +30,8 @@ public function mount(Product $product)
public function save()
{
+ $this->canOrAbort('update product');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Finance/Expense.php b/app/Livewire/Studio/Finance/Expense.php
index 5dd778f..3f3a8e9 100644
--- a/app/Livewire/Studio/Finance/Expense.php
+++ b/app/Livewire/Studio/Finance/Expense.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Finance\ExpenseForm;
use App\Models\Expense as ExpenseModel;
+use App\Traits\WithAuthorization;
use App\Traits\WithCloseModal;
use App\Traits\WithConfirmation;
use App\Traits\WithToast;
@@ -16,7 +17,7 @@
#[Title('Pengeluaran')]
class Expense extends Component
{
- use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
public ExpenseForm $form;
@@ -40,6 +41,8 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
public function create()
{
+ $this->canOrAbort('create expense');
+
$this->form->store();
$this->dispatch('refreshDatatable');
@@ -51,6 +54,8 @@ public function create()
public function update()
{
+ $this->canOrAbort('update expense');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Loyalty/Customer.php b/app/Livewire/Studio/Loyalty/Customer.php
index 4cb9c55..2868fa0 100644
--- a/app/Livewire/Studio/Loyalty/Customer.php
+++ b/app/Livewire/Studio/Loyalty/Customer.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Loyalty\CustomerForm;
use App\Models\Customer as CustomerModel;
+use App\Traits\WithAuthorization;
use App\Traits\WithCloseModal;
use App\Traits\WithConfirmation;
use App\Traits\WithToast;
@@ -16,7 +17,7 @@
#[Title('Customer')]
class Customer extends Component
{
- use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
public CustomerForm $form;
@@ -40,6 +41,8 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
public function create()
{
+ $this->canOrAbort('create customer');
+
$this->form->store();
$this->dispatch('refreshDatatable');
@@ -51,6 +54,8 @@ public function create()
public function update()
{
+ $this->canOrAbort('update customer');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Loyalty/Tier.php b/app/Livewire/Studio/Loyalty/Tier.php
index 833ba84..55ef6ec 100644
--- a/app/Livewire/Studio/Loyalty/Tier.php
+++ b/app/Livewire/Studio/Loyalty/Tier.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Loyalty\TierForm;
use App\Models\Tier as TierModel;
+use App\Traits\WithAuthorization;
use App\Traits\WithCloseModal;
use App\Traits\WithConfirmation;
use App\Traits\WithToast;
@@ -16,7 +17,7 @@
#[Title('Tier')]
class Tier extends Component
{
- use WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
+ use WithAuthorization, WithCloseModal, WithConfirmation, WithToast, WithUpdatedData;
public TierForm $form;
@@ -40,6 +41,8 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
public function create()
{
+ $this->canOrAbort('create tier');
+
$this->form->store();
$this->dispatch('refreshDatatable');
@@ -51,6 +54,8 @@ public function create()
public function update()
{
+ $this->canOrAbort('update tier');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Loyalty/Voucher/Create.php b/app/Livewire/Studio/Loyalty/Voucher/Create.php
index ec15454..fdd9799 100644
--- a/app/Livewire/Studio/Loyalty/Voucher/Create.php
+++ b/app/Livewire/Studio/Loyalty/Voucher/Create.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Loyalty\VoucherForm;
use App\Models\Outlet;
+use App\Traits\WithAuthorization;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
@@ -13,7 +14,7 @@
#[Title('Tambah Voucher')]
class Create extends Component
{
- use WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
public VoucherForm $form;
@@ -26,6 +27,8 @@ public function mount()
public function save()
{
+ $this->canOrAbort('create voucher');
+
$this->form->store();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Loyalty/Voucher/Edit.php b/app/Livewire/Studio/Loyalty/Voucher/Edit.php
index 125737d..70964f7 100644
--- a/app/Livewire/Studio/Loyalty/Voucher/Edit.php
+++ b/app/Livewire/Studio/Loyalty/Voucher/Edit.php
@@ -5,6 +5,7 @@
use App\Livewire\Forms\Studio\Loyalty\VoucherForm;
use App\Models\Outlet;
use App\Models\Voucher;
+use App\Traits\WithAuthorization;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
@@ -14,7 +15,7 @@
#[Title('Ubah Voucher')]
class Edit extends Component
{
- use WithOutletSelector, WithToast, WithUpdatedData;
+ use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
public VoucherForm $form;
@@ -29,6 +30,8 @@ public function mount(Voucher $voucher)
public function save()
{
+ $this->canOrAbort('update voucher');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Master/Outlet/Create.php b/app/Livewire/Studio/Master/Outlet/Create.php
index 66b81d4..3a31b5e 100644
--- a/app/Livewire/Studio/Master/Outlet/Create.php
+++ b/app/Livewire/Studio/Master/Outlet/Create.php
@@ -5,6 +5,7 @@
use App\Enums\Day;
use App\Livewire\Forms\Studio\Master\OutletForm;
use App\Traits\Outlet\WithFacilityHandler;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
@@ -13,7 +14,7 @@
#[Title('Tambah Outlet')]
class Create extends Component
{
- use WithFacilityHandler, WithToast, WithUpdatedData;
+ use WithAuthorization, WithFacilityHandler, WithToast, WithUpdatedData;
public OutletForm $form;
@@ -31,6 +32,8 @@ public function mount()
public function save()
{
+ $this->canOrAbort('create outlet');
+
$this->form->store();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Master/Outlet/Edit.php b/app/Livewire/Studio/Master/Outlet/Edit.php
index 03ae298..975cc34 100644
--- a/app/Livewire/Studio/Master/Outlet/Edit.php
+++ b/app/Livewire/Studio/Master/Outlet/Edit.php
@@ -6,6 +6,7 @@
use App\Livewire\Forms\Studio\Master\OutletForm;
use App\Models\Outlet;
use App\Traits\Outlet\WithFacilityHandler;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
@@ -14,7 +15,7 @@
#[Title('Ubah Outlet')]
class Edit extends Component
{
- use WithFacilityHandler, WithToast, WithUpdatedData;
+ use WithAuthorization, WithFacilityHandler, WithToast, WithUpdatedData;
public OutletForm $form;
@@ -29,6 +30,8 @@ public function mount(Outlet $outlet)
public function save()
{
+ $this->canOrAbort('update outlet');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Master/User/Create.php b/app/Livewire/Studio/Master/User/Create.php
index 446837a..af7b6ec 100644
--- a/app/Livewire/Studio/Master/User/Create.php
+++ b/app/Livewire/Studio/Master/User/Create.php
@@ -3,6 +3,7 @@
namespace App\Livewire\Studio\Master\User;
use App\Livewire\Forms\Studio\Master\UserForm;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
@@ -11,12 +12,14 @@
#[Title('Tambah Pegawai')]
class Create extends Component
{
- use WithToast, WithUpdatedData;
+ use WithAuthorization, WithToast, WithUpdatedData;
public UserForm $form;
public function save()
{
+ $this->canOrAbort('create user');
+
$this->form->store();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Master/User/Edit.php b/app/Livewire/Studio/Master/User/Edit.php
index 5625156..61a6db4 100644
--- a/app/Livewire/Studio/Master/User/Edit.php
+++ b/app/Livewire/Studio/Master/User/Edit.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Master\UserForm;
use App\Models\User;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
@@ -12,7 +13,7 @@
#[Title('Ubah Pegawai')]
class Edit extends Component
{
- use WithToast, WithUpdatedData;
+ use WithAuthorization, WithToast, WithUpdatedData;
public UserForm $form;
@@ -23,6 +24,8 @@ public function mount(User $user)
public function save()
{
+ $this->canOrAbort('update user');
+
$this->form->update();
$this->dispatch('refreshDatatable');
diff --git a/app/Livewire/Studio/Setting/Account.php b/app/Livewire/Studio/Setting/Account.php
index c7daa94..cda2fca 100644
--- a/app/Livewire/Studio/Setting/Account.php
+++ b/app/Livewire/Studio/Setting/Account.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Setting\AccountForm;
use App\Models\User;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
@@ -12,7 +13,7 @@
#[Title('Akun')]
class Account extends Component
{
- use WithToast, WithUpdatedData;
+ use WithAuthorization, WithToast, WithUpdatedData;
public AccountForm $form;
@@ -23,6 +24,8 @@ public function mount(User $user)
public function update()
{
+ $this->canOrAbort('update account');
+
$this->form->update();
$this->toast('Akun berhasil diperbarui.');
diff --git a/app/Livewire/Studio/Setting/Password.php b/app/Livewire/Studio/Setting/Password.php
index 84ed9f5..3fa47d7 100644
--- a/app/Livewire/Studio/Setting/Password.php
+++ b/app/Livewire/Studio/Setting/Password.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Setting\PasswordForm;
use App\Models\User;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Illuminate\Support\Facades\Hash;
@@ -13,7 +14,7 @@
#[Title('Kata Sandi')]
class Password extends Component
{
- use WithToast, WithUpdatedData;
+ use WithAuthorization, WithToast, WithUpdatedData;
public PasswordForm $form;
@@ -24,6 +25,8 @@ public function mount(User $user)
public function update()
{
+ $this->canOrAbort('update password');
+
if (! Hash::check($this->form->current_password, $this->form->user->password)) {
$this->toast('Kata sandi yang Anda masukkan tidak sesuai dengan kata sandi saat ini.', 'Gagal', 'danger');
diff --git a/app/Livewire/Studio/Setting/Profile.php b/app/Livewire/Studio/Setting/Profile.php
index e2228d1..2f84363 100644
--- a/app/Livewire/Studio/Setting/Profile.php
+++ b/app/Livewire/Studio/Setting/Profile.php
@@ -4,6 +4,7 @@
use App\Livewire\Forms\Studio\Setting\ProfileForm;
use App\Models\Employee;
+use App\Traits\WithAuthorization;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Livewire\Attributes\Title;
@@ -12,7 +13,7 @@
#[Title('Profil')]
class Profile extends Component
{
- use WithToast, WithUpdatedData;
+ use WithAuthorization, WithToast, WithUpdatedData;
public ProfileForm $form;
@@ -23,6 +24,8 @@ public function mount(Employee $employee)
public function update()
{
+ $this->canOrAbort('update profile');
+
$this->form->update();
$this->toast('Profil berhasil diperbarui.');
diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php
new file mode 100644
index 0000000..30bf18e
--- /dev/null
+++ b/app/Providers/ViewServiceProvider.php
@@ -0,0 +1,128 @@
+ 'Dasbor',
+ 'items' => [
+ [
+ 'label' => 'Ringkasan',
+ 'icon' => 'squares-plus',
+ 'route' => 'studio.dashboard.overview',
+ 'match' => 'studio.dashboard.overview',
+ 'can' => 'view overview',
+ ],
+ ],
+ ],
+ [
+ 'heading' => 'Master',
+ 'items' => [
+ [
+ 'label' => 'Outlet',
+ 'icon' => 'home-modern',
+ 'route' => 'studio.master.outlet.index',
+ 'match' => 'studio.master.outlet.*',
+ 'can' => 'view outlet',
+ ],
+ [
+ 'label' => 'Pegawai',
+ 'icon' => 'users',
+ 'route' => 'studio.master.user.index',
+ 'match' => 'studio.master.user.*',
+ 'can' => 'view user',
+ ],
+ ],
+ ],
+ [
+ 'heading' => 'Loyalty',
+ 'items' => [
+ [
+ 'label' => 'Tier',
+ 'icon' => 'star',
+ 'route' => 'studio.loyalty.tier.index',
+ 'match' => 'studio.loyalty.tier.*',
+ 'can' => 'view tier',
+ ],
+ [
+ 'label' => 'Voucher',
+ 'icon' => 'ticket',
+ 'route' => 'studio.loyalty.voucher.index',
+ 'match' => 'studio.loyalty.voucher.*',
+ 'can' => 'view voucher',
+ ],
+ [
+ 'label' => 'Customer',
+ 'icon' => 'user-plus',
+ 'route' => 'studio.loyalty.customer.index',
+ 'match' => 'studio.loyalty.customer.*',
+ 'can' => 'view customer',
+ ],
+ ],
+ ],
+ [
+ 'heading' => 'Katalog',
+ 'items' => [
+ [
+ 'label' => 'Kategori',
+ 'icon' => 'list-bullet',
+ 'route' => 'studio.catalog.category.index',
+ 'match' => 'studio.catalog.category.*',
+ 'can' => 'view category',
+ ],
+ [
+ 'label' => 'Merek',
+ 'icon' => 'tag',
+ 'route' => 'studio.catalog.brand.index',
+ 'match' => 'studio.catalog.brand.*',
+ 'can' => 'view brand',
+ ],
+ [
+ 'label' => 'Parfum',
+ 'icon' => 'flower-2',
+ 'route' => 'studio.catalog.perfume.index',
+ 'match' => 'studio.catalog.perfume.*',
+ 'can' => 'view perfume',
+ ],
+ [
+ 'label' => 'Produk',
+ 'icon' => 'boxes',
+ 'route' => 'studio.catalog.product.index',
+ 'match' => 'studio.catalog.product.*',
+ 'can' => 'view product',
+ ],
+ [
+ 'label' => 'Botol',
+ 'icon' => 'beaker',
+ 'route' => 'studio.catalog.bottle.index',
+ 'match' => 'studio.catalog.bottle.*',
+ 'can' => 'view bottle',
+ ],
+ ],
+ ],
+ [
+ 'heading' => 'Keuangan',
+ 'items' => [
+ [
+ 'label' => 'Pengeluaran',
+ 'icon' => 'banknote-arrow-down',
+ 'route' => 'studio.finance.expense.index',
+ 'match' => 'studio.finance.expense.*',
+ 'can' => 'view expense',
+ ],
+ ],
+ ],
+ ];
+
+ $view->with('sidebar', $sidebar);
+ });
+ }
+}
diff --git a/app/Traits/WithAuthorization.php b/app/Traits/WithAuthorization.php
new file mode 100644
index 0000000..cbd9db1
--- /dev/null
+++ b/app/Traits/WithAuthorization.php
@@ -0,0 +1,13 @@
+user()->cannot($ability, $model)) {
+ abort(403);
+ }
+ }
+}
diff --git a/bootstrap/providers.php b/bootstrap/providers.php
index 38b258d..6bdee7e 100644
--- a/bootstrap/providers.php
+++ b/bootstrap/providers.php
@@ -2,4 +2,5 @@
return [
App\Providers\AppServiceProvider::class,
+ App\Providers\ViewServiceProvider::class,
];
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index 739ab8b..cb2bfc7 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -9,6 +9,7 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
$this->call([
+ RolePermissionSeeder::class,
OutletSeeder::class,
UserSeeder::class,
TierSeeder::class,
diff --git a/database/seeders/RolePermissionSeeder.php b/database/seeders/RolePermissionSeeder.php
new file mode 100644
index 0000000..fe7982b
--- /dev/null
+++ b/database/seeders/RolePermissionSeeder.php
@@ -0,0 +1,194 @@
+ 'Developer']);
+ $owner = Role::firstOrCreate(['name' => 'Owner']);
+ $leader = Role::firstOrCreate(['name' => 'Leader']);
+ $admin = Role::firstOrCreate(['name' => 'Admin']);
+ $partner = Role::firstOrCreate(['name' => 'Partner']);
+ $customer = Role::firstOrCreate(['name' => 'Customer']);
+
+ $permissions = [
+ 'view account',
+ 'update account',
+
+ 'view profile',
+ 'update profile',
+
+ 'view password',
+ 'update password',
+
+ 'view overview',
+
+ 'view outlet',
+ 'create outlet',
+ 'update outlet',
+ 'delete outlet',
+
+ 'view user',
+ 'create user',
+ 'update user',
+ 'delete user',
+
+ 'view tier',
+ 'create tier',
+ 'update tier',
+ 'delete tier',
+
+ 'view voucher',
+ 'create voucher',
+ 'update voucher',
+ 'delete voucher',
+
+ 'view customer',
+ 'create customer',
+ 'update customer',
+ 'delete customer',
+
+ 'view category',
+ 'create category',
+ 'update category',
+ 'delete category',
+
+ 'view brand',
+ 'create brand',
+ 'update brand',
+ 'delete brand',
+
+ 'view perfume',
+ 'create perfume',
+ 'update perfume',
+ 'delete perfume',
+
+ 'view product',
+ 'create product',
+ 'update product',
+ 'delete product',
+
+ 'view bottle',
+ 'create bottle',
+ 'update bottle',
+ 'delete bottle',
+
+ 'view expense',
+ 'create expense',
+ 'update expense',
+ 'delete expense',
+ ];
+
+ foreach ($permissions as $permission) {
+ Permission::firstOrCreate(['name' => $permission]);
+ }
+
+ $developer->syncPermissions($permissions);
+
+ $owner->syncPermissions($permissions);
+
+ $leader->syncPermissions(array_diff($permissions, [
+ 'view outlet',
+ 'create outlet',
+ 'update outlet',
+ 'delete outlet',
+
+ 'view user',
+ 'create user',
+ 'update user',
+ 'delete user',
+
+ 'create tier',
+ 'update tier',
+ 'delete tier',
+
+ 'create voucher',
+ 'update voucher',
+ 'delete voucher',
+
+ 'create perfume',
+ 'update perfume',
+ 'delete perfume',
+
+ 'create product',
+ 'update product',
+ 'delete product',
+
+ 'create bottle',
+ 'update bottle',
+ 'delete bottle',
+ ]));
+
+ $admin->syncPermissions(array_diff($permissions, [
+ 'view outlet',
+ 'create outlet',
+ 'update outlet',
+ 'delete outlet',
+
+ 'view user',
+ 'create user',
+ 'update user',
+ 'delete user',
+
+ 'create tier',
+ 'update tier',
+ 'delete tier',
+
+ 'create voucher',
+ 'update voucher',
+ 'delete voucher',
+
+ 'create category',
+ 'update category',
+ 'delete category',
+
+ 'create brand',
+ 'update brand',
+ 'delete brand',
+
+ 'create perfume',
+ 'update perfume',
+ 'delete perfume',
+
+ 'create product',
+ 'update product',
+ 'delete product',
+
+ 'create bottle',
+ 'update bottle',
+ 'delete bottle',
+ ]));
+
+ $partner->syncPermissions([
+ 'view overview',
+
+ 'view account',
+ 'update account',
+
+ 'view profile',
+ 'update profile',
+
+ 'view password',
+ 'update password',
+ ]);
+
+ $customer->syncPermissions([
+ 'view overview',
+
+ 'view account',
+ 'update account',
+
+ 'view profile',
+ 'update profile',
+
+ 'view password',
+ 'update password',
+ ]);
+ }
+}
diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php
index 44ee5de..670e993 100644
--- a/database/seeders/UserSeeder.php
+++ b/database/seeders/UserSeeder.php
@@ -4,6 +4,7 @@
use App\Enums\EmploymentStatus;
use App\Enums\Gender;
+use App\Enums\UserRole;
use App\Models\Employee;
use App\Models\ReferralCode;
use App\Models\User;
@@ -36,5 +37,7 @@ public function run(): void
'user_id' => $user->id,
'code' => generateReferralCode('pangestu', 1),
]);
+
+ $user->assignRole(UserRole::Developer);
}
}
diff --git a/resources/views/components/partials/studio/_sidebar.blade.php b/resources/views/components/partials/studio/_sidebar.blade.php
index e297054..18950bc 100644
--- a/resources/views/components/partials/studio/_sidebar.blade.php
+++ b/resources/views/components/partials/studio/_sidebar.blade.php
@@ -1,75 +1,41 @@