140 lines
5.5 KiB
PHP
140 lines
5.5 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Account;
|
|
use App\Models\Locations\Location;
|
|
use App\Models\Organization;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class TestProfileSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$user1 = User::factory()
|
|
->has(Account::factory()->state(['name' => 'Personal Account']))
|
|
->has(Location::factory()->state(['city_id' => 305, 'division_id' => 12, 'country_id' => 1]))
|
|
->create([
|
|
'name' => 'Ronald',
|
|
'full_name' => 'Ronald',
|
|
'email' => 'ronald@test.nl',
|
|
'email_verified_at' => Carbon::now(),
|
|
'profile_photo_path' => timebank_config('profiles.user.profile_photo_path_default'),
|
|
'password' => bcrypt(timebank_config('init_passwords.test-profile')),
|
|
]);
|
|
|
|
$this->command->info('Ronald email and password: ronald@test.nl, ' . timebank_config('init_passwords.test-profile'));
|
|
|
|
|
|
$user2 = User::factory()
|
|
->has(Account::factory()->state(['name' => 'Personal Account']))
|
|
->has(Location::factory()->state(['city_id' => 345, 'country_id' => 2]))
|
|
->create([
|
|
'name' => 'Joeri',
|
|
'full_name' => 'Joeri',
|
|
'email' => 'joeri@test.nl',
|
|
'email_verified_at' => Carbon::now(),
|
|
'profile_photo_path' => timebank_config('profiles.user.profile_photo_path_default'),
|
|
'password' => bcrypt(timebank_config('init_passwords.test-profile')),
|
|
]);
|
|
|
|
$this->command->info('Joeri email and password: joeri@test.nl, ' . timebank_config('init_passwords.test-profile'));
|
|
|
|
|
|
$user3 = User::factory()
|
|
->has(Account::factory()->state(['name' => 'Personal Account']))
|
|
->has(Location::factory()->state(['city_id' => 330, 'division_id' => 12, 'country_id' => 1]))
|
|
->create([
|
|
'name' => 'Sara',
|
|
'full_name' => 'Sara',
|
|
'email' => 'sara@test.nl',
|
|
'email_verified_at' => Carbon::now(),
|
|
'profile_photo_path' => timebank_config('profiles.user.profile_photo_path_default'),
|
|
'password' => bcrypt(timebank_config('init_passwords.test-profile')),
|
|
]);
|
|
|
|
$this->command->info('Sara email and password: sara@test.nl, '. timebank_config('init_passwords.test-profile'));
|
|
|
|
|
|
$org1 = Organization::factory()
|
|
->has(Account::factory()->state(['name' => 'General Account'])->state(
|
|
['name' => 'Currency Creation',
|
|
'limit_min' => -12000
|
|
]
|
|
))
|
|
->has(Account::factory()->state(
|
|
['name' => 'General']
|
|
))
|
|
->has(Location::factory()->state(['city_id' => 305, 'division_id' => 12, 'country_id' => 1]))
|
|
->create([
|
|
'name' => 'Test Organization',
|
|
'full_name' => 'Test Organization The Hague',
|
|
'email' => 'test-organizationg@test.nl',
|
|
'email_verified_at' => Carbon::now(),
|
|
'profile_photo_path' => timebank_config('profiles.organization.profile_photo_path_default'),
|
|
'password' => bcrypt(timebank_config('init_passwords.test-profile')),
|
|
]);
|
|
|
|
$this->command->info('Test Organization email and password: test-organization@test.nl, ' . timebank_config('init_passwords.test-profile'));
|
|
|
|
$org2 = Organization::factory()
|
|
->has(Account::factory()->state(
|
|
['name' => 'Algemeen']
|
|
))
|
|
->has(Account::factory()->state(
|
|
['name' => 'Gymzaal']
|
|
))
|
|
->has(Account::factory()->state(
|
|
['name' => 'Wonnebald']
|
|
))
|
|
->has(Account::factory()->state(
|
|
['name' => 'Spinozahof']
|
|
))
|
|
->has(Account::factory()->state(
|
|
['name' => 'Mozartlaan']
|
|
))
|
|
->has(Location::factory()->state(['city_id' => 305, 'division_id' => 12, 'country_id' => 1]))
|
|
->create([
|
|
'name' => 'Lekkernassuh',
|
|
'full_name' => 'Lekkernassuh groentemarkt',
|
|
'email' => 'lekkernassuh@test.nl',
|
|
'email_verified_at' => Carbon::now(),
|
|
'profile_photo_path' => timebank_config('profiles.organization.profile_photo_path_default'),
|
|
'password' => bcrypt(timebank_config('init_passwords.test-profile')),
|
|
]);
|
|
|
|
DB::table('organization_user')->insert([
|
|
'organization_id' => $org1->id,
|
|
'user_id' => $user1->id]);
|
|
|
|
DB::table('organization_user')->insert([
|
|
'organization_id' => $org1->id,
|
|
'user_id' => $user2->id]);
|
|
|
|
DB::table('organization_user')->insert([
|
|
'organization_id' => $org2->id,
|
|
'user_id' => $user1->id]);
|
|
|
|
DB::table('organization_user')->insert([
|
|
'organization_id' => $org2->id,
|
|
'user_id' => $user2->id]);
|
|
|
|
DB::table('organization_user')->insert([
|
|
'organization_id' => $org2->id,
|
|
'user_id' => $user3->id]);
|
|
|
|
$this->command->info('Lekkernassuh email and password: lekkernassuh@test.nl, ' . timebank_config('init_passwords.test-profile'));
|
|
|
|
|
|
$this->command->info('The test profiles are seeded');
|
|
}
|
|
}
|