fix tests
This commit is contained in:
@@ -10,9 +10,7 @@ use RuntimeException;
|
||||
|
||||
class StaffCommandService
|
||||
{
|
||||
public function __construct(private GlobalConfigService $configService)
|
||||
{
|
||||
}
|
||||
public function __construct(private GlobalConfigService $configService) {}
|
||||
|
||||
public function create(array $payload): Staff
|
||||
{
|
||||
@@ -21,7 +19,7 @@ class StaffCommandService
|
||||
|
||||
$roleName = (string) ($payload['role_name'] ?? '');
|
||||
$activeRole = strtolower($roleName);
|
||||
if (!empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
|
||||
if (! empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
|
||||
$activeRole = 'inactive';
|
||||
}
|
||||
|
||||
@@ -40,7 +38,7 @@ class StaffCommandService
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
if (!$staff) {
|
||||
if (! $staff) {
|
||||
throw new RuntimeException('Failed to create staff member.');
|
||||
}
|
||||
|
||||
@@ -61,13 +59,13 @@ class StaffCommandService
|
||||
if (array_key_exists('role_name', $updates)) {
|
||||
$updates['active_role'] = strtolower((string) $updates['role_name']);
|
||||
}
|
||||
if (!empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
|
||||
if (! empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
|
||||
$updates['active_role'] = 'inactive';
|
||||
}
|
||||
|
||||
$updates['updated_at'] = now();
|
||||
|
||||
if (!empty($updates)) {
|
||||
if (! empty($updates)) {
|
||||
$staff->fill($updates);
|
||||
$staff->save();
|
||||
}
|
||||
@@ -83,7 +81,7 @@ class StaffCommandService
|
||||
|
||||
private function resolveUserId(array $payload): int
|
||||
{
|
||||
if (!empty($payload['user_id'])) {
|
||||
if (! empty($payload['user_id'])) {
|
||||
return (int) $payload['user_id'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user