From 0efdf4455a944cd9ac53e63b5a39c968beae1192 Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Wed, 30 Nov 2022 18:11:00 +0100 Subject: [PATCH] add blueprint files to git --- app/Models/.gitignore | 5 - app/Models/Category.php | 35 ++++++ app/Models/City.php | 36 ++++++ app/Models/Country.php | 35 ++++++ app/Models/Course.php | 41 ++++++ app/Models/Event.php | 46 +++++++ app/Models/Lecturer.php | 39 ++++++ app/Models/Participant.php | 30 +++++ app/Models/Registration.php | 44 +++++++ app/Models/Venue.php | 38 ++++++ app/Nova/.gitignore | 3 - app/Nova/Category.php | 101 +++++++++++++++ app/Nova/City.php | 98 +++++++++++++++ app/Nova/Country.php | 101 +++++++++++++++ app/Nova/Course.php | 101 +++++++++++++++ app/Nova/Event.php | 102 +++++++++++++++ app/Nova/Lecturer.php | 105 ++++++++++++++++ app/Nova/Participant.php | 98 +++++++++++++++ app/Nova/Registration.php | 99 +++++++++++++++ app/Nova/Team.php | 97 ++++++++++++++ app/Nova/User.php | 118 ++++++++++++++++++ app/Nova/Venue.php | 104 +++++++++++++++ database/factories/.gitignore | 3 - database/factories/CategoryFactory.php | 30 +++++ database/factories/CityFactory.php | 31 +++++ database/factories/CountryFactory.php | 30 +++++ database/factories/CourseFactory.php | 31 +++++ database/factories/EventFactory.php | 34 +++++ database/factories/LecturerFactory.php | 33 +++++ database/factories/ParticipantFactory.php | 30 +++++ database/factories/RegistrationFactory.php | 33 +++++ database/factories/VenueFactory.php | 33 +++++ database/migrations/.gitignore | 4 - ...22_11_30_170514_create_countries_table.php | 33 +++++ .../2022_11_30_170515_create_cities_table.php | 37 ++++++ ...22_11_30_170516_create_lecturers_table.php | 39 ++++++ ...11_30_170517_create_participants_table.php | 37 ++++++ ...2_11_30_170518_create_categories_table.php | 37 ++++++ ...2022_11_30_170519_create_courses_table.php | 37 ++++++ .../2022_11_30_170520_create_venues_table.php | 39 ++++++ .../2022_11_30_170521_create_events_table.php | 39 ++++++ ...1_30_170522_create_registrations_table.php | 38 ++++++ ...30_170523_create_category_course_table.php | 35 ++++++ 43 files changed, 2124 insertions(+), 15 deletions(-) delete mode 100644 app/Models/.gitignore create mode 100644 app/Models/Category.php create mode 100644 app/Models/City.php create mode 100644 app/Models/Country.php create mode 100644 app/Models/Course.php create mode 100644 app/Models/Event.php create mode 100644 app/Models/Lecturer.php create mode 100644 app/Models/Participant.php create mode 100644 app/Models/Registration.php create mode 100644 app/Models/Venue.php delete mode 100644 app/Nova/.gitignore create mode 100644 app/Nova/Category.php create mode 100644 app/Nova/City.php create mode 100644 app/Nova/Country.php create mode 100644 app/Nova/Course.php create mode 100644 app/Nova/Event.php create mode 100644 app/Nova/Lecturer.php create mode 100644 app/Nova/Participant.php create mode 100644 app/Nova/Registration.php create mode 100644 app/Nova/Team.php create mode 100644 app/Nova/User.php create mode 100644 app/Nova/Venue.php delete mode 100644 database/factories/.gitignore create mode 100644 database/factories/CategoryFactory.php create mode 100644 database/factories/CityFactory.php create mode 100644 database/factories/CountryFactory.php create mode 100644 database/factories/CourseFactory.php create mode 100644 database/factories/EventFactory.php create mode 100644 database/factories/LecturerFactory.php create mode 100644 database/factories/ParticipantFactory.php create mode 100644 database/factories/RegistrationFactory.php create mode 100644 database/factories/VenueFactory.php delete mode 100644 database/migrations/.gitignore create mode 100644 database/migrations/2022_11_30_170514_create_countries_table.php create mode 100644 database/migrations/2022_11_30_170515_create_cities_table.php create mode 100644 database/migrations/2022_11_30_170516_create_lecturers_table.php create mode 100644 database/migrations/2022_11_30_170517_create_participants_table.php create mode 100644 database/migrations/2022_11_30_170518_create_categories_table.php create mode 100644 database/migrations/2022_11_30_170519_create_courses_table.php create mode 100644 database/migrations/2022_11_30_170520_create_venues_table.php create mode 100644 database/migrations/2022_11_30_170521_create_events_table.php create mode 100644 database/migrations/2022_11_30_170522_create_registrations_table.php create mode 100644 database/migrations/2022_11_30_170523_create_category_course_table.php diff --git a/app/Models/.gitignore b/app/Models/.gitignore deleted file mode 100644 index 47dadd55..00000000 --- a/app/Models/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.php -!Membership.php -!Team.php -!TeamInvitation.php -!User.php diff --git a/app/Models/Category.php b/app/Models/Category.php new file mode 100644 index 00000000..a494578c --- /dev/null +++ b/app/Models/Category.php @@ -0,0 +1,35 @@ + 'integer', + ]; + + public function courses(): \Illuminate\Database\Eloquent\Relations\BelongsToMany + { + return $this->belongsToMany(Course::class); + } +} diff --git a/app/Models/City.php b/app/Models/City.php new file mode 100644 index 00000000..ce843017 --- /dev/null +++ b/app/Models/City.php @@ -0,0 +1,36 @@ + 'integer', + 'country_id' => 'integer', + ]; + + public function country(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Country::class); + } +} diff --git a/app/Models/Country.php b/app/Models/Country.php new file mode 100644 index 00000000..aad394cd --- /dev/null +++ b/app/Models/Country.php @@ -0,0 +1,35 @@ + 'integer', + ]; + + public function cities(): \Illuminate\Database\Eloquent\Relations\HasMany + { + return $this->hasMany(City::class); + } +} diff --git a/app/Models/Course.php b/app/Models/Course.php new file mode 100644 index 00000000..fd0cbbcf --- /dev/null +++ b/app/Models/Course.php @@ -0,0 +1,41 @@ + 'integer', + 'lecturer_id' => 'integer', + ]; + + public function categories(): \Illuminate\Database\Eloquent\Relations\BelongsToMany + { + return $this->belongsToMany(Category::class); + } + + public function lecturer(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Lecturer::class); + } +} diff --git a/app/Models/Event.php b/app/Models/Event.php new file mode 100644 index 00000000..eaf417d8 --- /dev/null +++ b/app/Models/Event.php @@ -0,0 +1,46 @@ + 'integer', + 'course_id' => 'integer', + 'venue_id' => 'integer', + 'from' => 'datetime', + 'to' => 'datetime', + ]; + + public function course(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Course::class); + } + + public function venue(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Venue::class); + } +} diff --git a/app/Models/Lecturer.php b/app/Models/Lecturer.php new file mode 100644 index 00000000..83e0df4b --- /dev/null +++ b/app/Models/Lecturer.php @@ -0,0 +1,39 @@ + 'integer', + 'team_id' => 'integer', + 'active' => 'boolean', + ]; + + public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Team::class); + } +} diff --git a/app/Models/Participant.php b/app/Models/Participant.php new file mode 100644 index 00000000..6395859c --- /dev/null +++ b/app/Models/Participant.php @@ -0,0 +1,30 @@ + 'integer', + ]; +} diff --git a/app/Models/Registration.php b/app/Models/Registration.php new file mode 100644 index 00000000..514cd716 --- /dev/null +++ b/app/Models/Registration.php @@ -0,0 +1,44 @@ + 'integer', + 'event_id' => 'integer', + 'participant_id' => 'integer', + 'active' => 'boolean', + ]; + + public function event(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Event::class); + } + + public function participant(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Participant::class); + } +} diff --git a/app/Models/Venue.php b/app/Models/Venue.php new file mode 100644 index 00000000..d2bd6dc6 --- /dev/null +++ b/app/Models/Venue.php @@ -0,0 +1,38 @@ + 'integer', + 'city_id' => 'integer', + ]; + + public function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(City::class); + } +} diff --git a/app/Nova/.gitignore b/app/Nova/.gitignore deleted file mode 100644 index b1aa2f7f..00000000 --- a/app/Nova/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.php -!Resource.php -!Dashboards/*.php diff --git a/app/Nova/Category.php b/app/Nova/Category.php new file mode 100644 index 00000000..f72a67c4 --- /dev/null +++ b/app/Nova/Category.php @@ -0,0 +1,101 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string'), + + Text::make('Slug') + ->rules('required', 'string', 'unique:categories,slug'), + + BelongsToMany::make('Courses'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/City.php b/app/Nova/City.php new file mode 100644 index 00000000..b0112a95 --- /dev/null +++ b/app/Nova/City.php @@ -0,0 +1,98 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string'), + + BelongsTo::make('Country'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Country.php b/app/Nova/Country.php new file mode 100644 index 00000000..fd9457fd --- /dev/null +++ b/app/Nova/Country.php @@ -0,0 +1,101 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string'), + + Text::make('Code') + ->rules('required', 'string'), + + HasMany::make('Cities'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Course.php b/app/Nova/Course.php new file mode 100644 index 00000000..c98a6ebd --- /dev/null +++ b/app/Nova/Course.php @@ -0,0 +1,101 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string'), + + BelongsTo::make('Lecturer'), + + BelongsToMany::make('Categories'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Event.php b/app/Nova/Event.php new file mode 100644 index 00000000..46cef740 --- /dev/null +++ b/app/Nova/Event.php @@ -0,0 +1,102 @@ +sortable(), + + DateTime::make('From') + ->rules('required'), + + DateTime::make('To') + ->rules('required'), + + BelongsTo::make('Course'), + BelongsTo::make('Venue'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Lecturer.php b/app/Nova/Lecturer.php new file mode 100644 index 00000000..dc6bbc9a --- /dev/null +++ b/app/Nova/Lecturer.php @@ -0,0 +1,105 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string'), + + Text::make('Slug') + ->rules('required', 'string', 'unique:lecturers,slug'), + + Boolean::make('Active') + ->rules('required'), + + BelongsTo::make('Team'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Participant.php b/app/Nova/Participant.php new file mode 100644 index 00000000..1d588412 --- /dev/null +++ b/app/Nova/Participant.php @@ -0,0 +1,98 @@ +sortable(), + + Text::make('First name') + ->rules('required', 'string'), + + Text::make('Last name') + ->rules('required', 'string'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Registration.php b/app/Nova/Registration.php new file mode 100644 index 00000000..5c5d8b93 --- /dev/null +++ b/app/Nova/Registration.php @@ -0,0 +1,99 @@ +sortable(), + + Boolean::make('Active') + ->rules('required'), + + BelongsTo::make('Event'), + BelongsTo::make('Participant'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Team.php b/app/Nova/Team.php new file mode 100644 index 00000000..2219d18b --- /dev/null +++ b/app/Nova/Team.php @@ -0,0 +1,97 @@ + + */ + public static $model = \App\Models\Team::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * @var string + */ + public static $title = 'name'; + + /** + * The columns that should be searched. + * @var array + */ + public static $search = [ + 'id', 'name', + ]; + + /** + * Get the fields displayed by the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function fields(NovaRequest $request) + { + return [ + ID::make() + ->sortable(), + + Text::make('Name') + ->sortable() + ->rules('required', 'max:255'), + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function cards(NovaRequest $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function filters(NovaRequest $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function lenses(NovaRequest $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function actions(NovaRequest $request) + { + return []; + } +} diff --git a/app/Nova/User.php b/app/Nova/User.php new file mode 100644 index 00000000..1494823e --- /dev/null +++ b/app/Nova/User.php @@ -0,0 +1,118 @@ + + */ + public static $model = \App\Models\User::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * @var string + */ + public static $title = 'name'; + + /** + * The columns that should be searched. + * @var array + */ + public static $search = [ + 'id', 'name', 'email', + ]; + + /** + * Get the fields displayed by the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function fields(NovaRequest $request) + { + return [ + ID::make() + ->sortable(), + + Gravatar::make() + ->maxWidth(50), + + Text::make('Name') + ->sortable() + ->rules('required', 'max:255'), + + Text::make('Email') + ->sortable() + ->rules('required', 'email', 'max:254') + ->creationRules('unique:users,email') + ->updateRules('unique:users,email,{{resourceId}}'), + + Password::make('Password') + ->onlyOnForms() + ->creationRules('required', Rules\Password::defaults()) + ->updateRules('nullable', Rules\Password::defaults()), + + MorphToMany::make('Roles', 'roles', \Itsmejoshua\Novaspatiepermissions\Role::class), + MorphToMany::make('Permissions', 'permissions', \Itsmejoshua\Novaspatiepermissions\Permission::class), + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function cards(NovaRequest $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function filters(NovaRequest $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function lenses(NovaRequest $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Laravel\Nova\Http\Requests\NovaRequest $request + * + * @return array + */ + public function actions(NovaRequest $request) + { + return []; + } +} diff --git a/app/Nova/Venue.php b/app/Nova/Venue.php new file mode 100644 index 00000000..07f88ac7 --- /dev/null +++ b/app/Nova/Venue.php @@ -0,0 +1,104 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string'), + + Text::make('Slug') + ->rules('required', 'string', 'unique:venues,slug'), + + Text::make('Street') + ->rules('required', 'string'), + + BelongsTo::make('City'), + + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/database/factories/.gitignore b/database/factories/.gitignore deleted file mode 100644 index bd917b32..00000000 --- a/database/factories/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.php -!TeamFactory.php -!UserFactory.php diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php new file mode 100644 index 00000000..03343cac --- /dev/null +++ b/database/factories/CategoryFactory.php @@ -0,0 +1,30 @@ + $this->faker->name, + 'slug' => $this->faker->slug, + ]; + } +} diff --git a/database/factories/CityFactory.php b/database/factories/CityFactory.php new file mode 100644 index 00000000..10f0e6cc --- /dev/null +++ b/database/factories/CityFactory.php @@ -0,0 +1,31 @@ + Country::factory(), + 'name' => $this->faker->name, + ]; + } +} diff --git a/database/factories/CountryFactory.php b/database/factories/CountryFactory.php new file mode 100644 index 00000000..0c8d744d --- /dev/null +++ b/database/factories/CountryFactory.php @@ -0,0 +1,30 @@ + $this->faker->name, + 'code' => $this->faker->word, + ]; + } +} diff --git a/database/factories/CourseFactory.php b/database/factories/CourseFactory.php new file mode 100644 index 00000000..5a24b7be --- /dev/null +++ b/database/factories/CourseFactory.php @@ -0,0 +1,31 @@ + Lecturer::factory(), + 'name' => $this->faker->name, + ]; + } +} diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php new file mode 100644 index 00000000..f321b740 --- /dev/null +++ b/database/factories/EventFactory.php @@ -0,0 +1,34 @@ + Course::factory(), + 'venue_id' => Venue::factory(), + 'from' => $this->faker->dateTime(), + 'to' => $this->faker->dateTime(), + ]; + } +} diff --git a/database/factories/LecturerFactory.php b/database/factories/LecturerFactory.php new file mode 100644 index 00000000..35f10361 --- /dev/null +++ b/database/factories/LecturerFactory.php @@ -0,0 +1,33 @@ + Team::factory(), + 'name' => $this->faker->name, + 'slug' => $this->faker->slug, + 'active' => $this->faker->boolean, + ]; + } +} diff --git a/database/factories/ParticipantFactory.php b/database/factories/ParticipantFactory.php new file mode 100644 index 00000000..6c63c5cf --- /dev/null +++ b/database/factories/ParticipantFactory.php @@ -0,0 +1,30 @@ + $this->faker->firstName, + 'last_name' => $this->faker->lastName, + ]; + } +} diff --git a/database/factories/RegistrationFactory.php b/database/factories/RegistrationFactory.php new file mode 100644 index 00000000..92922f89 --- /dev/null +++ b/database/factories/RegistrationFactory.php @@ -0,0 +1,33 @@ + Event::factory(), + 'participant_id' => Participant::factory(), + 'active' => $this->faker->boolean, + ]; + } +} diff --git a/database/factories/VenueFactory.php b/database/factories/VenueFactory.php new file mode 100644 index 00000000..6843c49d --- /dev/null +++ b/database/factories/VenueFactory.php @@ -0,0 +1,33 @@ + City::factory(), + 'name' => $this->faker->name, + 'slug' => $this->faker->slug, + 'street' => $this->faker->streetName, + ]; + } +} diff --git a/database/migrations/.gitignore b/database/migrations/.gitignore deleted file mode 100644 index 4a281110..00000000 --- a/database/migrations/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -2022_* -!2014_* -!2019_* -!2020_* diff --git a/database/migrations/2022_11_30_170514_create_countries_table.php b/database/migrations/2022_11_30_170514_create_countries_table.php new file mode 100644 index 00000000..00bbbdf7 --- /dev/null +++ b/database/migrations/2022_11_30_170514_create_countries_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('name'); + $table->string('code'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('countries'); + } +} diff --git a/database/migrations/2022_11_30_170515_create_cities_table.php b/database/migrations/2022_11_30_170515_create_cities_table.php new file mode 100644 index 00000000..4a9a0b66 --- /dev/null +++ b/database/migrations/2022_11_30_170515_create_cities_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('country_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->string('name'); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('cities'); + } +} diff --git a/database/migrations/2022_11_30_170516_create_lecturers_table.php b/database/migrations/2022_11_30_170516_create_lecturers_table.php new file mode 100644 index 00000000..c80b9603 --- /dev/null +++ b/database/migrations/2022_11_30_170516_create_lecturers_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('team_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->string('name'); + $table->string('slug')->unique(); + $table->boolean('active')->default(true); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('lecturers'); + } +} diff --git a/database/migrations/2022_11_30_170517_create_participants_table.php b/database/migrations/2022_11_30_170517_create_participants_table.php new file mode 100644 index 00000000..eee07292 --- /dev/null +++ b/database/migrations/2022_11_30_170517_create_participants_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('first_name'); + $table->string('last_name'); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('participants'); + } +} diff --git a/database/migrations/2022_11_30_170518_create_categories_table.php b/database/migrations/2022_11_30_170518_create_categories_table.php new file mode 100644 index 00000000..cd36b3a2 --- /dev/null +++ b/database/migrations/2022_11_30_170518_create_categories_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('name'); + $table->string('slug')->unique(); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('categories'); + } +} diff --git a/database/migrations/2022_11_30_170519_create_courses_table.php b/database/migrations/2022_11_30_170519_create_courses_table.php new file mode 100644 index 00000000..524cce65 --- /dev/null +++ b/database/migrations/2022_11_30_170519_create_courses_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('lecturer_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->string('name'); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('courses'); + } +} diff --git a/database/migrations/2022_11_30_170520_create_venues_table.php b/database/migrations/2022_11_30_170520_create_venues_table.php new file mode 100644 index 00000000..aacdf18f --- /dev/null +++ b/database/migrations/2022_11_30_170520_create_venues_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('city_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->string('name'); + $table->string('slug')->unique(); + $table->string('street'); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('venues'); + } +} diff --git a/database/migrations/2022_11_30_170521_create_events_table.php b/database/migrations/2022_11_30_170521_create_events_table.php new file mode 100644 index 00000000..1921b7b7 --- /dev/null +++ b/database/migrations/2022_11_30_170521_create_events_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('course_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->foreignId('venue_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->dateTime('from'); + $table->dateTime('to'); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('events'); + } +} diff --git a/database/migrations/2022_11_30_170522_create_registrations_table.php b/database/migrations/2022_11_30_170522_create_registrations_table.php new file mode 100644 index 00000000..62f218c4 --- /dev/null +++ b/database/migrations/2022_11_30_170522_create_registrations_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignId('event_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary(); + $table->foreignId('participant_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary(); + $table->boolean('active')->default(true); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('registrations'); + } +} diff --git a/database/migrations/2022_11_30_170523_create_category_course_table.php b/database/migrations/2022_11_30_170523_create_category_course_table.php new file mode 100644 index 00000000..a106ba6e --- /dev/null +++ b/database/migrations/2022_11_30_170523_create_category_course_table.php @@ -0,0 +1,35 @@ +foreignId('category_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->foreignId('course_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('category_course'); + } +}