Basic seeder, navigating to application page
This commit is contained in:
@@ -9,7 +9,7 @@ return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('application', function (Blueprint $table) {
|
||||
Schema::create('applications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Organisation::class);
|
||||
$table->string('name');
|
||||
@@ -21,6 +21,6 @@ return new class extends Migration
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('application');
|
||||
Schema::dropIfExists('applications');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\OrganisationRole;
|
||||
use App\Enums\RepositoryType;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
@@ -15,9 +18,30 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
// User::factory(10)->create();
|
||||
|
||||
User::factory()->create([
|
||||
$user = User::factory()->create([
|
||||
'name' => 'Harry',
|
||||
'email' => 'harry@hjb.dev',
|
||||
]);
|
||||
|
||||
$organisation = Organisation::create([
|
||||
'name' => 'Stratbucket',
|
||||
'slug' => 'stratbucket',
|
||||
'owner_id' => 1,
|
||||
]);
|
||||
|
||||
$organisation->members()->attach($user, ['role' => OrganisationRole::Admin]);
|
||||
|
||||
$application = $organisation->applications()->create([
|
||||
'name' => 'ClipBin',
|
||||
'repository_url' => 'git@github.com:hjbdev/clipbin.git',
|
||||
'repository_type' => RepositoryType::Git,
|
||||
]);
|
||||
|
||||
$application->environments()->create([
|
||||
'name' => 'Dev',
|
||||
'branch' => 'main',
|
||||
'url' => 'https://dev.clipbin.hjb.dev',
|
||||
'status' => 'active'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user