diff --git a/app/Containers/Widget/Data/Factories/SlideFactory.php b/app/Containers/Widget/Data/Factories/SlideFactory.php index 61ab877..ed83a52 100755 --- a/app/Containers/Widget/Data/Factories/SlideFactory.php +++ b/app/Containers/Widget/Data/Factories/SlideFactory.php @@ -36,7 +36,7 @@ class SlideFactory extends Factory 'start_time' => $this->faker->dateTimeBetween('-1 week', '+1 week'), 'end_time' => $this->faker->dateTimeBetween('+1 week', '+2 weeks'), 'sort' => $this->faker->numberBetween(1, 10), - // slider_id будет установлен в сидере + 'slider_id' => \App\Containers\Widget\Models\Slider::factory(), 'slidable_id' => null, 'slidable_type' => null, ]; diff --git a/database/factories/AcademicJournalFactory.php b/database/factories/AcademicJournalFactory.php new file mode 100644 index 0000000..16c4a0b --- /dev/null +++ b/database/factories/AcademicJournalFactory.php @@ -0,0 +1,26 @@ +faker->unique()->words(3, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'main_info' => ['description' => $this->faker->paragraph], + 'chief_editor' => ['name' => $this->faker->name], + 'editors' => [['name' => $this->faker->name], ['name' => $this->faker->name]], + 'for_authors' => ['requirements' => $this->faker->paragraph], + 'is_active' => $this->faker->boolean(80), + 'search_data' => $this->faker->words(5, true), + ]; + } +} diff --git a/database/factories/AdditionalEducationCategoryFactory.php b/database/factories/AdditionalEducationCategoryFactory.php new file mode 100644 index 0000000..cae2974 --- /dev/null +++ b/database/factories/AdditionalEducationCategoryFactory.php @@ -0,0 +1,23 @@ +faker->unique()->words(2, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'is_active' => $this->faker->boolean(80), + 'dir_addit_educat_id' => DirectionAdditionalEducation::factory(), + ]; + } +} diff --git a/database/factories/AdditionalEducationFactory.php b/database/factories/AdditionalEducationFactory.php new file mode 100644 index 0000000..0f828e4 --- /dev/null +++ b/database/factories/AdditionalEducationFactory.php @@ -0,0 +1,31 @@ +faker->unique()->words(4, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'content' => [['type' => 'paragraph', 'data' => ['content' => $this->faker->paragraph]]], + 'category_id' => AdditionalEducationCategory::factory(), + 'target_group' => $this->faker->randomElement(['Студенты', 'Педагоги', 'Специалисты', 'Все']), + 'qualification' => $this->faker->optional()->word, + 'price' => $this->faker->numberBetween(5000, 150000), + 'learning_time' => $this->faker->randomElement([72, 144, 216, 360, 720]), + 'form_education' => $this->faker->randomElement([FormEducation::FULL_TIME->value, FormEducation::FULL_PART_TIME->value, FormEducation::PART_TIME->value]), + 'is_active' => $this->faker->boolean(80), + 'search_data' => $this->faker->words(5, true), + ]; + } +} diff --git a/database/factories/AdmissionCampaignFactory.php b/database/factories/AdmissionCampaignFactory.php new file mode 100644 index 0000000..c87cddf --- /dev/null +++ b/database/factories/AdmissionCampaignFactory.php @@ -0,0 +1,41 @@ +value, + LevelEducational::MASTER->value, + LevelEducational::SPECIALIST->value, + ]; + + $info = array_map(function ($lvl) { + $och = $this->faker->numberBetween(10, 100); + $zaoch = $this->faker->numberBetween(5, 50); + return [ + 'edu_name' => $lvl, + 'total_programs' => $this->faker->numberBetween(3, 10), + 'och_count' => $och, + 'zaoch_count' => $zaoch, + 'budget_places' => (int) ($och * 0.6), + 'non_budget_places' => (int) ($och * 0.4) + $zaoch, + ]; + }, $levels); + + return [ + 'name' => 'Прием ' . $this->faker->year . ' года', + 'academic_year' => $this->faker->year . '-' . ($this->faker->year + 1), + 'status' => AdmissionCampaignStatus::ACTIVE->value, + 'info' => $info, + ]; + } +} diff --git a/database/factories/AdmissionPlanFactory.php b/database/factories/AdmissionPlanFactory.php new file mode 100644 index 0000000..67953f8 --- /dev/null +++ b/database/factories/AdmissionPlanFactory.php @@ -0,0 +1,22 @@ + EducationalProgram::factory(), + 'admission_campaigns_id' => AdmissionCampaign::factory(), + 'exams' => $this->faker->words(3, true), + 'contests' => [['name' => $this->faker->word, 'places' => $this->faker->numberBetween(5, 50)]], + ]; + } +} diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php index dcddc88..2322e54 100755 --- a/database/factories/CategoryFactory.php +++ b/database/factories/CategoryFactory.php @@ -10,6 +10,8 @@ use Illuminate\Support\Str; */ class CategoryFactory extends Factory { + protected $model = \App\Containers\Article\Models\Category::class; + /** * Define the model's default state. * diff --git a/database/factories/ContactWidgetFactory.php b/database/factories/ContactWidgetFactory.php new file mode 100644 index 0000000..51984a7 --- /dev/null +++ b/database/factories/ContactWidgetFactory.php @@ -0,0 +1,26 @@ +faker->unique()->words(2, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'content' => [ + ['type' => 'phone', 'value' => $this->faker->phoneNumber], + ['type' => 'email', 'value' => $this->faker->safeEmail], + ['type' => 'address', 'value' => $this->faker->address], + ], + 'is_active' => $this->faker->boolean(80), + ]; + } +} diff --git a/database/factories/CustomFormFactory.php b/database/factories/CustomFormFactory.php new file mode 100644 index 0000000..a8a918a --- /dev/null +++ b/database/factories/CustomFormFactory.php @@ -0,0 +1,30 @@ + $this->faker->unique()->words(2, true), + 'description' => $this->faker->sentence, + 'form_id' => $this->faker->unique()->uuid, + 'columns' => [ + ['name' => 'name', 'type' => 'text', 'required' => true], + ['name' => 'email', 'type' => 'email', 'required' => true], + ['name' => 'message', 'type' => 'textarea', 'required' => false], + ], + 'button' => 'Отправить', + 'send_message' => 'Спасибо за обращение!', + 'mail_settings' => ['to' => $this->faker->safeEmail], + 'settings' => null, + 'status' => $this->faker->randomElement([CustomFormStatus::PUBLISHED->value, CustomFormStatus::HIDDEN->value]), + ]; + } +} diff --git a/database/factories/CustomFormResponseFactory.php b/database/factories/CustomFormResponseFactory.php new file mode 100644 index 0000000..888f8f0 --- /dev/null +++ b/database/factories/CustomFormResponseFactory.php @@ -0,0 +1,24 @@ + CustomForm::factory(), + 'answers' => [ + 'name' => $this->faker->name, + 'email' => $this->faker->safeEmail, + 'message' => $this->faker->paragraph, + ], + 'checked' => $this->faker->boolean(30), + ]; + } +} diff --git a/database/factories/DepartmentFactory.php b/database/factories/DepartmentFactory.php index 96c6b89..d0ee40c 100755 --- a/database/factories/DepartmentFactory.php +++ b/database/factories/DepartmentFactory.php @@ -11,6 +11,8 @@ use Illuminate\Support\Str; */ class DepartmentFactory extends Factory { + protected $model = \App\Containers\InstituteStructure\Models\Department::class; + /** * Define the model's default state. * diff --git a/database/factories/DirectionAdditionalEducationFactory.php b/database/factories/DirectionAdditionalEducationFactory.php new file mode 100644 index 0000000..ec80dfe --- /dev/null +++ b/database/factories/DirectionAdditionalEducationFactory.php @@ -0,0 +1,21 @@ +faker->unique()->words(3, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'is_active' => $this->faker->boolean(80), + ]; + } +} diff --git a/database/factories/DirectionStudyFactory.php b/database/factories/DirectionStudyFactory.php new file mode 100644 index 0000000..883ef2f --- /dev/null +++ b/database/factories/DirectionStudyFactory.php @@ -0,0 +1,29 @@ +faker->unique()->words(3, true); + return [ + 'uuid' => $this->faker->uuid, + 'name' => $name, + 'slug' => Str::slug($name), + 'code' => $this->faker->numerify('##.##.##'), + 'lvl_edu' => $this->faker->randomElement([ + LevelEducational::BACHELOR->value, + LevelEducational::MASTER->value, + LevelEducational::SPECIALIST->value, + ]), + 'info' => ['description' => $this->faker->paragraph], + ]; + } +} diff --git a/database/factories/DivisionFactory.php b/database/factories/DivisionFactory.php new file mode 100644 index 0000000..cb7672c --- /dev/null +++ b/database/factories/DivisionFactory.php @@ -0,0 +1,23 @@ +faker->unique()->words(3, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'description' => ['description' => $this->faker->paragraph], + 'is_active' => $this->faker->boolean(80), + 'search_data' => $this->faker->words(5, true), + ]; + } +} diff --git a/database/factories/EducationalGroupFactory.php b/database/factories/EducationalGroupFactory.php index 72da5bf..d554d2f 100755 --- a/database/factories/EducationalGroupFactory.php +++ b/database/factories/EducationalGroupFactory.php @@ -6,11 +6,13 @@ use Illuminate\Database\Eloquent\Factories\Factory; class EducationalGroupFactory extends Factory { + protected $model = \App\Containers\Schedule\Models\EducationalGroup::class; + public function definition(): array { return [ 'title' => $this->faker->words(3, true), - 'faculty_id' => \App\Models\Faculty::factory(), + 'faculty_id' => \App\Containers\InstituteStructure\Models\Faculty::factory(), 'education_form_id' => $this->faker->numberBetween(1, 3), 'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'), 'updated_at' => $this->faker->dateTimeBetween('-1 year', 'now'), diff --git a/database/factories/EducationalProgramFactory.php b/database/factories/EducationalProgramFactory.php new file mode 100644 index 0000000..650f650 --- /dev/null +++ b/database/factories/EducationalProgramFactory.php @@ -0,0 +1,36 @@ +faker->unique()->words(4, true); + return [ + 'uuid' => $this->faker->uuid, + 'name' => $name, + 'slug' => Str::slug($name), + 'about_program' => ['description' => $this->faker->paragraph], + 'program_features' => ['features' => $this->faker->paragraph], + 'inner_code' => $this->faker->numerify('###'), + 'lvl_edu' => $this->faker->randomElement([ + LevelEducational::BACHELOR->value, + LevelEducational::MASTER->value, + LevelEducational::SPECIALIST->value, + ]), + 'status' => $this->faker->randomElement(['active', 'inactive']), + 'lang_stud' => $this->faker->randomElement(['ru', 'en']), + 'learning_forms' => ['full_time', 'part_time'], + 'direction_study_id' => DirectionStudy::factory(), + 'search_data' => $this->faker->words(5, true), + ]; + } +} diff --git a/database/factories/EventCategoryFactory.php b/database/factories/EventCategoryFactory.php index 92a2b32..7283f26 100755 --- a/database/factories/EventCategoryFactory.php +++ b/database/factories/EventCategoryFactory.php @@ -10,6 +10,8 @@ use Illuminate\Support\Str; */ class EventCategoryFactory extends Factory { + protected $model = \App\Containers\Event\Models\EventCategory::class; + /** * Define the model's default state. * diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php index 648bc1b..31da916 100755 --- a/database/factories/EventFactory.php +++ b/database/factories/EventFactory.php @@ -11,6 +11,8 @@ use Illuminate\Support\Str; */ class EventFactory extends Factory { + protected $model = \App\Containers\Event\Models\Event::class; + /** * Define the model's default state. * diff --git a/database/factories/FacultyFactory.php b/database/factories/FacultyFactory.php index f680a07..39a66e9 100755 --- a/database/factories/FacultyFactory.php +++ b/database/factories/FacultyFactory.php @@ -10,6 +10,8 @@ use Illuminate\Support\Str; */ class FacultyFactory extends Factory { + protected $model = \App\Containers\InstituteStructure\Models\Faculty::class; + /** * Define the model's default state. * diff --git a/database/factories/IntegrationCredentialFactory.php b/database/factories/IntegrationCredentialFactory.php new file mode 100644 index 0000000..57dae54 --- /dev/null +++ b/database/factories/IntegrationCredentialFactory.php @@ -0,0 +1,19 @@ + $this->faker->unique()->randomElement(['vk', 'telegram', 'email', '1c']), + 'payload' => ['token' => $this->faker->uuid, 'secret' => $this->faker->sha256], + 'is_active' => $this->faker->boolean(80), + ]; + } +} diff --git a/database/factories/JournalIssueFactory.php b/database/factories/JournalIssueFactory.php new file mode 100644 index 0000000..2b1cb75 --- /dev/null +++ b/database/factories/JournalIssueFactory.php @@ -0,0 +1,23 @@ + 'Выпуск ' . $this->faker->numberBetween(1, 12) . '/' . $this->faker->year, + 'path_file' => 'journals/' . $this->faker->uuid . '.pdf', + 'year_publication' => $this->faker->numberBetween(2020, 2025), + 'is_active' => $this->faker->boolean(80), + 'sort' => $this->faker->optional()->numberBetween(1, 100), + 'academic_journal_id' => AcademicJournal::factory(), + ]; + } +} diff --git a/database/factories/MainSectionFactory.php b/database/factories/MainSectionFactory.php new file mode 100644 index 0000000..d3d2930 --- /dev/null +++ b/database/factories/MainSectionFactory.php @@ -0,0 +1,21 @@ +faker->unique()->words(2, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'sort' => $this->faker->numberBetween(1, 100), + ]; + } +} diff --git a/database/factories/PageFactory.php b/database/factories/PageFactory.php index 9e99e7e..9a1f715 100755 --- a/database/factories/PageFactory.php +++ b/database/factories/PageFactory.php @@ -2,22 +2,34 @@ namespace Database\Factories; +use App\Containers\AppStructure\Models\SubSection; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Str; -/** - * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Page> - */ class PageFactory extends Factory { - /** - * Define the model's default state. - * - * @return array - */ + protected $model = \App\Containers\AppStructure\Models\Page::class; + public function definition(): array { + $title = $this->faker->words(3, true); + $slug = Str::slug($title); + return [ - // + 'title' => $title, + 'slug' => $slug, + 'path' => $slug, + 'content' => [['type' => 'paragraph', 'data' => ['content' => $this->faker->paragraph]]], + 'is_registered' => false, + 'is_visible' => true, + 'searchable' => true, + 'is_url' => false, + 'code' => 200, + 'sub_section_id' => null, + 'search_data' => $this->faker->words(5, true), + 'settings' => null, + 'sort' => $this->faker->numberBetween(1, 100), + 'icon' => null, ]; } } diff --git a/database/factories/PageReferenceListFactory.php b/database/factories/PageReferenceListFactory.php new file mode 100644 index 0000000..cbcd529 --- /dev/null +++ b/database/factories/PageReferenceListFactory.php @@ -0,0 +1,25 @@ +faker->unique()->words(3, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'content' => [ + ['title' => $this->faker->words(2, true), 'url' => $this->faker->url], + ['title' => $this->faker->words(2, true), 'url' => $this->faker->url], + ], + 'is_active' => $this->faker->boolean(80), + ]; + } +} diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php index 237cdb2..3560695 100755 --- a/database/factories/PostFactory.php +++ b/database/factories/PostFactory.php @@ -10,6 +10,8 @@ use Illuminate\Support\Str; class PostFactory extends Factory { + protected $model = \App\Containers\Article\Models\Post::class; + /** * Define the model's default state. * diff --git a/database/factories/ScheduleFactory.php b/database/factories/ScheduleFactory.php index dd75b33..1de644f 100755 --- a/database/factories/ScheduleFactory.php +++ b/database/factories/ScheduleFactory.php @@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Factories\Factory; class ScheduleFactory extends Factory { + protected $model = \App\Containers\Schedule\Models\Schedule::class; + public function definition(): array { $fileName = $this->faker->unique()->word . '.pdf'; @@ -17,7 +19,7 @@ class ScheduleFactory extends Factory 'path' => 'schedules/' . $this->faker->slug . '-' . time() . '.pdf' ] ], - 'educational_group_id' => \App\Models\EducationalGroup::factory(), + 'educational_group_id' => \App\Containers\Schedule\Models\EducationalGroup::factory(), 'created_at' => $this->faker->dateTimeBetween('-6 months', 'now'), 'updated_at' => $this->faker->dateTimeBetween('-6 months', 'now'), ]; diff --git a/database/factories/SliderFactory.php b/database/factories/SliderFactory.php new file mode 100644 index 0000000..86d5f41 --- /dev/null +++ b/database/factories/SliderFactory.php @@ -0,0 +1,21 @@ +faker->unique()->words(2, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'is_active' => $this->faker->boolean(80), + ]; + } +} diff --git a/database/factories/SubSectionFactory.php b/database/factories/SubSectionFactory.php new file mode 100644 index 0000000..cfe8628 --- /dev/null +++ b/database/factories/SubSectionFactory.php @@ -0,0 +1,23 @@ +faker->unique()->words(2, true); + return [ + 'title' => $title, + 'slug' => Str::slug($title), + 'sort' => $this->faker->numberBetween(1, 100), + 'main_section_id' => MainSection::factory(), + ]; + } +} diff --git a/database/factories/TagFactory.php b/database/factories/TagFactory.php new file mode 100644 index 0000000..cbabadc --- /dev/null +++ b/database/factories/TagFactory.php @@ -0,0 +1,20 @@ + ['ru' => $this->faker->unique()->word, 'en' => $this->faker->unique()->word], + 'slug' => ['ru' => $this->faker->unique()->slug(1), 'en' => $this->faker->unique()->slug(1)], + 'type' => $this->faker->optional()->randomElement(['post', 'event', 'page']), + 'order_column' => $this->faker->optional()->numberBetween(1, 100), + ]; + } +} diff --git a/database/factories/UserDetailFactory.php b/database/factories/UserDetailFactory.php index 1aa4344..31ac699 100755 --- a/database/factories/UserDetailFactory.php +++ b/database/factories/UserDetailFactory.php @@ -10,6 +10,8 @@ use Illuminate\Database\Eloquent\Factories\Factory; */ class UserDetailFactory extends Factory { + protected $model = \App\Containers\User\Models\UserDetail::class; + /** * Define the model's default state. * @@ -36,7 +38,7 @@ class UserDetailFactory extends Factory }; return [ - 'user_id' => null, // Это будет установлено позже + 'user_id' => User::factory(), 'is_only_worker' => $this->faker->boolean, 'photo' => "images/01J7TKMCR55KY7ARS2DA6VVAHE.jpg", 'academicTitle' => $this->faker->word, @@ -48,7 +50,6 @@ class UserDetailFactory extends Factory 'professionalDevelopment' => $generateItems(), 'workExperience' => $this->faker->randomDigit(), 'attendedConferences' => $generateItems(), - 'participationScienceProjects' => $generateItems(), 'publications' => $generateItems(), 'contactEmail' => $this->faker->unique()->safeEmail, 'contactPhone' => $this->faker->phoneNumber, diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index c441d47..a2187f1 100755 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,14 +2,16 @@ namespace Database\Factories; +use App\Containers\User\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; /** - * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Containers\User\Models\User> */ class UserFactory extends Factory { + protected $model = User::class; /** * Define the model's default state. *