Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with create contributor command #86

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Console/Commands/ContributorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
fn () => Contributor::create([
'name' => $name,
'email' => $email,
'role' => $role ?? RoleEnum::owner->value,
'role' => RoleEnum::fromLabel($role) ?? RoleEnum::owner->value,
'password' => Hash::make($password),
]),
'Creating contributor...'
Expand Down
8 changes: 8 additions & 0 deletions src/Enums/RoleEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ public function label(): string
};
}

public static function fromLabel($label): self
{
return match ($label) {
'Owner' => self::owner,
'Translator' => self::translator,
};
}

public function description(): string
{
return match ($this) {
Expand Down
5 changes: 3 additions & 2 deletions src/Exceptions/TranslationsUIExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Outhebox\TranslationsUI\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as BaseHandler;
use App\Exceptions\Handler;
use Illuminate\Foundation\Exceptions\Handler as BaseHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
Expand All @@ -18,7 +18,8 @@ class ExtendedHandler extends Handler
// Extend the custom handler
}
} else {
class ExtendedHandler extends BaseHandler {
class ExtendedHandler extends BaseHandler
{
// Extend the default handler
}
}
Expand Down
Loading