- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees) - Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue) - Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts - Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs - Remove legacy and dead CSV employee import/export code - Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation - Add comprehensive Pest unit, integration, and feature test coverage
32 lines
709 B
PHP
32 lines
709 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Policies\Backend;
|
|
|
|
use App\Dto\SettingDto;
|
|
use App\Models\Customer;
|
|
use App\Models\Setting;
|
|
use App\Models\User;
|
|
use Domain\Enums\UserRole;
|
|
|
|
class SettingPolicy
|
|
{
|
|
public function view(User | Customer $user, Setting | SettingDto | null $_ = null): bool
|
|
{
|
|
if ($user instanceof Customer) {
|
|
return false;
|
|
}
|
|
|
|
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
|
|
}
|
|
|
|
public function update(User | Customer $user, Setting | SettingDto | null $_ = null): bool
|
|
{
|
|
if ($user instanceof Customer) {
|
|
return false;
|
|
}
|
|
|
|
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
|
|
}
|
|
}
|