add test batches
This commit is contained in:
@@ -10,7 +10,9 @@ use RuntimeException;
|
||||
|
||||
class StaffCommandService
|
||||
{
|
||||
public function __construct(private GlobalConfigService $configService) {}
|
||||
public function __construct(private GlobalConfigService $configService)
|
||||
{
|
||||
}
|
||||
|
||||
public function create(array $payload): Staff
|
||||
{
|
||||
@@ -19,7 +21,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';
|
||||
}
|
||||
|
||||
@@ -38,7 +40,7 @@ class StaffCommandService
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
if (! $staff) {
|
||||
if (!$staff) {
|
||||
throw new RuntimeException('Failed to create staff member.');
|
||||
}
|
||||
|
||||
@@ -59,13 +61,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();
|
||||
}
|
||||
@@ -81,7 +83,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