예제 #1
0
 /**
  * Execute the command.
  *
  * @param RoleRepositoryInterface $repository
  */
 public function handle(RoleRepositoryInterface $repository)
 {
     /**
      * Create Role
      */
     $repository->create($this->roleName, $this->display_name, $this->roleDescription);
 }
예제 #2
0
 /**
  * Handle the event.
  *
  * @param  UserWasCreated $event
  * @return void
  */
 public function handle(UserWasCreated $event)
 {
     $role_id = $event->role;
     if (is_string($event->role)) {
         $role_id = $this->repository->find($event->role)->id;
     }
     /**
      * Attach Role To User
      */
     $this->repository->attach($event->user->id, $role_id);
 }