Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Sep 29, 2021
1 parent bfb8176 commit 603656a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

namespace App\Containers\AppSection\Authorization\Data\Seeders;

use App\Containers\AppSection\Authorization\Tasks\FindRoleTask;
use App\Containers\AppSection\User\Tasks\CreateUserByCredentialsTask;
use App\Containers\AppSection\User\Actions\CreateAdminAction;
use App\Containers\AppSection\User\UI\API\Requests\CreateAdminRequest;
use App\Ship\Exceptions\CreateResourceFailedException;
use App\Ship\Exceptions\NotFoundException;
use App\Ship\Parents\Seeders\Seeder;

class AuthorizationDefaultUsersSeeder_4 extends Seeder
{
/**
* @throws CreateResourceFailedException
* @throws NotFoundException
*/
public function run(): void
{
Expand All @@ -23,8 +21,8 @@ public function run(): void
];

// Default Users (with their roles) ---------------------------------------------
$admin = app(CreateUserByCredentialsTask::class)->run($userData);
$admin->assignRole(app(FindRoleTask::class)->run(config('appSection-authorization.admin_role')));
$request = new CreateAdminRequest($userData);
$admin = app(CreateAdminAction::class)->run($request);
$admin->email_verified_at = now();
$admin->save();
}
Expand Down

0 comments on commit 603656a

Please sign in to comment.