Refactor broadcast notifications (#1402)

* Refactor broadcast notifications

* StyleCI fixes

* Fix the planned_distance accidental changes
This commit is contained in:
Nabeel S
2022-02-08 15:07:02 -05:00
committed by GitHub
parent 6cfbd91328
commit cb38f2ad90
17 changed files with 290 additions and 119 deletions

View File

@@ -9,6 +9,7 @@ use App\Models\Pirep;
use App\Models\Role;
use App\Models\Subfleet;
use App\Models\User;
use App\Services\UserService;
use Exception;
trait TestData
@@ -32,6 +33,25 @@ trait TestData
], $attrs));
}
/**
* Create an admin user
*
* @param array $attrs
*
* @return User
*/
public function createAdminUser(array $attrs = []): User
{
/** @var User $admin */
$admin = factory(User::class)->create($attrs);
/** @var UserService $userSvc */
$userSvc = app(UserService::class);
$userSvc->addUserToRole($admin, 'admin');
return $admin;
}
/**
* Create a new PIREP with a proper subfleet/rank/user and an
* aircraft that the user is allowed to fly