-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,11 @@ class DatabaseSeeder extends Seeder | |
*/ | ||
public function run(): void | ||
{ | ||
// User::factory(10)->withPersonalTeam()->create(); | ||
|
||
User::factory()->withPersonalTeam()->create([ | ||
'name' => 'Test User', | ||
'email' => '[email protected]', | ||
$this->call([ | ||
MenuSeeder::class, | ||
RolesSeeder::class, | ||
TeamSeeder::class, | ||
UserSeeder::class, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,20 @@ class SiteSettingsSeeder extends Seeder | |
public function run() | ||
{ | ||
SiteSettings::create([ | ||
'name' => config('app.name', 'Liberu Real Estate'), | ||
'name' => config('app.name', 'Liberu '), | ||
'currency' => '£', | ||
'default_language' => 'en', | ||
'address' => '123 Real Estate St, London, UK', | ||
'address' => '123 St, London, UK', | ||
'country' => 'United Kingdom', | ||
'email' => '[email protected]', | ||
'phone_01' => '+44 123 456 7890', | ||
'phone_02' => '+44 123 456 7890', | ||
'phone_03' => '+44 123 456 7890', | ||
'phone_04' => '+44 123 456 7890', | ||
'facebook' => 'https://facebook.com/liberusoftware', | ||
'twitter' => 'https://twitter.com/liberusoftware', | ||
'github' => 'https://Github.com/liberusoftware', | ||
'youtube' => 'https://YouTube.com/@liberusoftware', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Team; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class TeamSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$team = Team::create([ | ||
'id' => 1, | ||
'name' => 'default', | ||
'personal_team' => false, | ||
'user_id' => 1, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Team; | ||
use App\Models\User; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
use Illuminate\Support\Facades\Hash; | ||
|
||
class UserSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$adminUser = User::create([ | ||
'name' => 'Admin User', | ||
'email' => '[email protected]', | ||
'password' => Hash::make('password'), | ||
'email_verified_at' => now(), | ||
]); | ||
$adminUser->assignRole('admin'); | ||
|
||
$staffUser = User::create([ | ||
'name' => 'Staff User', | ||
'email' => '[email protected]', | ||
'password' => Hash::make('password'), | ||
'email_verified_at' => now(), | ||
]); | ||
$staffUser->assignRole('staff'); | ||
|
||
// Create teams for admin and staff users | ||
$this->createTeamForUser($adminUser); | ||
$this->createTeamForUser($staffUser); | ||
} | ||
|
||
private function createTeamForUser($user) | ||
{ | ||
$team = Team::first(); | ||
$team->users()->attach($user); | ||
|
||
$user->current_team_id = 1; | ||
$user->save(); | ||
} | ||
} |