test(casts): add tests for ShopperEstablishmentCodeCast functionality test(casts): add tests for ShopperServiceCodeCast functionality test(casts): add tests for ShopperSiteCodeCast functionality test(dto): update ProductDtoTest to include additional fields test(dto): update SettingDtoTest to remove arcadiaSites assertions test(events): update AnOrderHasBeenPlacedTest to use value objects test(entities): update OrderTest to use value objects for employee details test(value-objects): update EmployeeUpsertDataTest to use value objects test(pagination): update PaginationTest to access value properties test(services): update AppCustomerAuthServiceTest to use CrmHashcode test(services): update CrmServiceTest to use CrmHashcode for customer retrieval
46 lines
919 B
PHP
46 lines
919 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\EmployeeSitesCast;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string[]|null $employee_sites
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Setting extends Model
|
|
{
|
|
public const int SINGLETON_ID = 1;
|
|
|
|
protected $fillable = [
|
|
'employee_sites',
|
|
];
|
|
|
|
/**
|
|
* @return array<string, class-string|string>
|
|
*/
|
|
#[\Override]
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'employee_sites' => EmployeeSitesCast::class,
|
|
];
|
|
}
|
|
|
|
public static function getSingleton(): self
|
|
{
|
|
return self::query()->firstOrCreate(
|
|
['id' => self::SINGLETON_ID],
|
|
[
|
|
'employee_sites' => [],
|
|
]
|
|
);
|
|
}
|
|
}
|