mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
meetups added
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Database\Factories;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Course;
|
||||
use App\Models\Event;
|
||||
use App\Models\CourseEvent;
|
||||
use App\Models\Venue;
|
||||
|
||||
class EventFactory extends Factory
|
||||
@@ -15,7 +15,7 @@ class EventFactory extends Factory
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Event::class;
|
||||
protected $model = CourseEvent::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
|
||||
36
database/factories/MeetupEventFactory.php
Normal file
36
database/factories/MeetupEventFactory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Meetup;
|
||||
use App\Models\MeetupEvent;
|
||||
|
||||
class MeetupEventFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = MeetupEvent::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'meetup_id' => Meetup::factory(),
|
||||
'date' => $this->faker->date(),
|
||||
'start' => $this->faker->time(),
|
||||
'end' => $this->faker->time(),
|
||||
'location' => $this->faker->word,
|
||||
'description' => $this->faker->text,
|
||||
'link' => $this->faker->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
32
database/factories/MeetupFactory.php
Normal file
32
database/factories/MeetupFactory.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\City;
|
||||
use App\Models\Meetup;
|
||||
|
||||
class MeetupFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Meetup::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'city_id' => City::factory(),
|
||||
'name' => $this->faker->name,
|
||||
'link' => $this->faker->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Event;
|
||||
use App\Models\CourseEvent;
|
||||
use App\Models\Participant;
|
||||
use App\Models\Registration;
|
||||
|
||||
@@ -25,7 +25,7 @@ class RegistrationFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'event_id' => Event::factory(),
|
||||
'event_id' => CourseEvent::factory(),
|
||||
'participant_id' => Participant::factory(),
|
||||
'active' => $this->faker->boolean,
|
||||
];
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateEventsTable extends Migration
|
||||
class CreateCourseEventsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
@@ -15,7 +15,7 @@ class CreateEventsTable extends Migration
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::create('events', function (Blueprint $table) {
|
||||
Schema::create('course_events', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('course_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate();
|
||||
$table->foreignId('venue_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate();
|
||||
@@ -34,6 +34,6 @@ class CreateEventsTable extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('events');
|
||||
Schema::dropIfExists('course_events');
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class CreateRegistrationsTable extends Migration
|
||||
|
||||
Schema::create('registrations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('event_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary();
|
||||
$table->foreignId('course_event_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary();
|
||||
$table->foreignId('participant_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
@@ -11,7 +11,7 @@ return new class extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
Schema::table('course_events', function (Blueprint $table) {
|
||||
$table->string('link');
|
||||
});
|
||||
}
|
||||
@@ -22,7 +22,7 @@ return new class extends Migration {
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
Schema::table('course_events', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMeetupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::create('meetups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('city_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate();
|
||||
$table->string('name')->unique();
|
||||
$table->string('link');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('meetups');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMeetupEventsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::create('meetup_events', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('meetup_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
$table->dateTime('start');
|
||||
$table->string('location')
|
||||
->nullable();
|
||||
$table->text('description')
|
||||
->nullable();
|
||||
$table->string('link')
|
||||
->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('meetup_events');
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,12 @@ use App\Models\Category;
|
||||
use App\Models\City;
|
||||
use App\Models\Country;
|
||||
use App\Models\Course;
|
||||
use App\Models\Event;
|
||||
use App\Models\CourseEvent;
|
||||
use App\Models\Lecturer;
|
||||
use App\Models\Library;
|
||||
use App\Models\LibraryItem;
|
||||
use App\Models\Meetup;
|
||||
use App\Models\MeetupEvent;
|
||||
use App\Models\Participant;
|
||||
use App\Models\Registration;
|
||||
use App\Models\Team;
|
||||
@@ -170,7 +172,7 @@ class DatabaseSeeder extends Seeder
|
||||
'first_name' => 'Roman',
|
||||
'last_name' => 'Reher',
|
||||
]);
|
||||
Event::create([
|
||||
CourseEvent::create([
|
||||
'course_id' => 2,
|
||||
'venue_id' => 1,
|
||||
'link' => 'https://einundzwanzig.space',
|
||||
@@ -182,7 +184,7 @@ class DatabaseSeeder extends Seeder
|
||||
->startOfDay()
|
||||
->addHour(),
|
||||
]);
|
||||
Event::create([
|
||||
CourseEvent::create([
|
||||
'course_id' => 1,
|
||||
'venue_id' => 2,
|
||||
'link' => 'https://einundzwanzig.space',
|
||||
@@ -194,7 +196,7 @@ class DatabaseSeeder extends Seeder
|
||||
->startOfDay()
|
||||
->addHour(),
|
||||
]);
|
||||
Event::create([
|
||||
CourseEvent::create([
|
||||
'course_id' => 1,
|
||||
'venue_id' => 3,
|
||||
'link' => 'https://einundzwanzig.space',
|
||||
@@ -206,7 +208,7 @@ class DatabaseSeeder extends Seeder
|
||||
->startOfDay()
|
||||
->addHour(),
|
||||
]);
|
||||
Event::create([
|
||||
CourseEvent::create([
|
||||
'course_id' => 3,
|
||||
'venue_id' => 3,
|
||||
'link' => 'https://einundzwanzig.space',
|
||||
@@ -219,8 +221,8 @@ class DatabaseSeeder extends Seeder
|
||||
->addHour(),
|
||||
]);
|
||||
Registration::create([
|
||||
'event_id' => 1,
|
||||
'participant_id' => 1,
|
||||
'course_event_id' => 1,
|
||||
'participant_id' => 1,
|
||||
]);
|
||||
$library = Library::create([
|
||||
'name' => 'Einundzwanzig',
|
||||
@@ -281,5 +283,20 @@ class DatabaseSeeder extends Seeder
|
||||
->attach($libraryItem);
|
||||
Artisan::call(ReadAndSyncEinundzwanzigPodcastFeed::class);
|
||||
Artisan::call(SyncOpenBooks::class);
|
||||
Meetup::create([
|
||||
'city_id' => 1,
|
||||
'name' => 'Einundzwanzig Kempten',
|
||||
'link' => 'https://t.me/EinundzwanzigKempten',
|
||||
]);
|
||||
MeetupEvent::create([
|
||||
'meetup_id' => 1,
|
||||
'start' => now()
|
||||
->addDays(2)
|
||||
->startOfDay()
|
||||
->addHours(20),
|
||||
'location' => 'Einundzwanzig Kempten',
|
||||
'description' => fake()->text(),
|
||||
'link' => 'https://t.me/EinundzwanzigKempten',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user