Get company_id from session when creating test user

This commit is contained in:
Burak Çakırel
2020-01-07 18:14:28 +03:00
parent fb8c25dfb3
commit 021fdb7b05

View File

@@ -35,7 +35,7 @@ class TestCompany extends Seeder
private function createCompany()
{
$this->dispatch(new CreateCompany([
$company = $this->dispatch(new CreateCompany([
'name' => 'My Company',
'domain' => 'company.com',
'address' => 'New Street 1254',
@@ -49,23 +49,23 @@ class TestCompany extends Seeder
],
]));
session(['company_id' => $company->id]);
$this->command->info('Test company created.');
}
public function createUser()
{
$user = $this->dispatch(new CreateUser([
$this->dispatch(new CreateUser([
'name' => 'Test User',
'email' => 'test@company.com',
'password' => '123456',
'locale' => 'en-GB',
'companies' => ['1'],
'companies' => [session('company_id')],
'roles' => ['1'],
'enabled' => '1',
]));
session(['company_id' => $user->companies()->pluck('id')->first()]);
$this->command->info('Test user created.');
}