From ade2422a4bfae12c884c8f228c674699ba0449a9 Mon Sep 17 00:00:00 2001 From: aslan Date: Thu, 29 Feb 2024 17:58:02 +0300 Subject: [PATCH] reorganization resource Cost, Places, Placetype, Period --- .../Catalog/Direction/CostController.php | 88 ------------- .../Catalog/Direction/PeriodController.php | 88 ------------- .../Catalog/Direction/PlaceController.php | 97 -------------- .../Catalog/Direction/PlaceTypeController.php | 70 ---------- .../Catalog/Direction/StoreCostRequest.php | 24 ---- .../Catalog/Direction/StorePeriodRequest.php | 24 ---- .../Catalog/Direction/StorePlaceRequest.php | 25 ---- .../Direction/StorePlaceTypeRequest.php | 23 ---- .../Catalog/Direction/UpdateCostRequest.php | 24 ---- .../Catalog/Direction/UpdatePeriodRequest.php | 24 ---- .../Catalog/Direction/UpdatePlaceRequest.php | 25 ---- .../Direction/UpdatePlaceTypeRequest.php | 32 ----- app/Models/Cost.php | 32 ----- app/Models/Period.php | 32 ----- app/Models/Place.php | 38 ------ app/Models/PlaceType.php | 25 ---- database/factories/CostFactory.php | 19 --- database/factories/PeriodFactory.php | 19 --- database/factories/PlaceFactory.php | 21 --- database/factories/PlaceTypeFactory.php | 18 --- .../2024_02_19_110021_create_places_table.php | 34 ----- .../2024_02_26_055033_create_costs_table.php | 32 ----- ...2024_02_26_080134_create_periods_table.php | 32 ----- database/seeders/CostSeeder.php | 30 ----- database/seeders/PeriodSeeder.php | 30 ----- database/seeders/PlaceSeeder.php | 34 ----- database/seeders/PlaceTypeSeeder.php | 31 ----- .../catalog/direction/cost/create.blade.php | 79 ------------ .../catalog/direction/cost/edit.blade.php | 79 ------------ .../catalog/direction/cost/index.blade.php | 45 ------- .../catalog/direction/cost/show.blade.php | 17 --- .../catalog/direction/period/create.blade.php | 79 ------------ .../catalog/direction/period/edit.blade.php | 79 ------------ .../catalog/direction/period/index.blade.php | 45 ------- .../catalog/direction/period/show.blade.php | 17 --- .../catalog/direction/place/create.blade.php | 103 --------------- .../catalog/direction/place/edit.blade.php | 103 --------------- .../catalog/direction/place/index.blade.php | 49 ------- .../catalog/direction/place/show.blade.php | 21 --- .../direction/place_type/create.blade.php | 65 ---------- .../direction/place_type/edit.blade.php | 66 ---------- .../direction/place_type/index.blade.php | 41 ------ .../direction/place_type/show.blade.php | 19 --- .../admin/catalog/direction/CostTest.php | 117 ----------------- .../admin/catalog/direction/PeriodTest.php | 116 ----------------- .../admin/catalog/direction/PlaceTest.php | 120 ------------------ .../admin/catalog/direction/PlaceTypeTest.php | 102 --------------- 47 files changed, 2333 deletions(-) delete mode 100644 app/Http/Controllers/admin/Catalog/Direction/CostController.php delete mode 100644 app/Http/Controllers/admin/Catalog/Direction/PeriodController.php delete mode 100644 app/Http/Controllers/admin/Catalog/Direction/PlaceController.php delete mode 100644 app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/StoreCostRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/StorePeriodRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/StorePlaceTypeRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/UpdateCostRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/UpdatePeriodRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php delete mode 100644 app/Http/Requests/admin/Catalog/Direction/UpdatePlaceTypeRequest.php delete mode 100644 app/Models/Cost.php delete mode 100644 app/Models/Period.php delete mode 100644 app/Models/Place.php delete mode 100644 app/Models/PlaceType.php delete mode 100644 database/factories/CostFactory.php delete mode 100644 database/factories/PeriodFactory.php delete mode 100644 database/factories/PlaceFactory.php delete mode 100644 database/factories/PlaceTypeFactory.php delete mode 100644 database/migrations/2024_02_19_110021_create_places_table.php delete mode 100644 database/migrations/2024_02_26_055033_create_costs_table.php delete mode 100644 database/migrations/2024_02_26_080134_create_periods_table.php delete mode 100644 database/seeders/CostSeeder.php delete mode 100644 database/seeders/PeriodSeeder.php delete mode 100644 database/seeders/PlaceSeeder.php delete mode 100644 database/seeders/PlaceTypeSeeder.php delete mode 100644 resources/views/admin/catalog/direction/cost/create.blade.php delete mode 100644 resources/views/admin/catalog/direction/cost/edit.blade.php delete mode 100644 resources/views/admin/catalog/direction/cost/index.blade.php delete mode 100644 resources/views/admin/catalog/direction/cost/show.blade.php delete mode 100644 resources/views/admin/catalog/direction/period/create.blade.php delete mode 100644 resources/views/admin/catalog/direction/period/edit.blade.php delete mode 100644 resources/views/admin/catalog/direction/period/index.blade.php delete mode 100644 resources/views/admin/catalog/direction/period/show.blade.php delete mode 100644 resources/views/admin/catalog/direction/place/create.blade.php delete mode 100644 resources/views/admin/catalog/direction/place/edit.blade.php delete mode 100644 resources/views/admin/catalog/direction/place/index.blade.php delete mode 100644 resources/views/admin/catalog/direction/place/show.blade.php delete mode 100644 resources/views/admin/catalog/direction/place_type/create.blade.php delete mode 100644 resources/views/admin/catalog/direction/place_type/edit.blade.php delete mode 100644 resources/views/admin/catalog/direction/place_type/index.blade.php delete mode 100644 resources/views/admin/catalog/direction/place_type/show.blade.php delete mode 100644 tests/Feature/admin/catalog/direction/CostTest.php delete mode 100644 tests/Feature/admin/catalog/direction/PeriodTest.php delete mode 100644 tests/Feature/admin/catalog/direction/PlaceTest.php delete mode 100644 tests/Feature/admin/catalog/direction/PlaceTypeTest.php diff --git a/app/Http/Controllers/admin/Catalog/Direction/CostController.php b/app/Http/Controllers/admin/Catalog/Direction/CostController.php deleted file mode 100644 index a8c9d33..0000000 --- a/app/Http/Controllers/admin/Catalog/Direction/CostController.php +++ /dev/null @@ -1,88 +0,0 @@ -validated(); - - $cost = new Cost(); - $cost->position = $validated['position']; - $cost->description = $validated['description']; - $cost->cost = $validated['cost']; - $cost->education_form_id = $validated['education_form_id']; - $cost->direction_id = $validated['direction_id']; - $cost->save(); - - return redirect()->route('costs.index'); - } - - public function show(Cost $cost): View - { - return view('admin.catalog.direction.cost.show', compact('cost')); - } - - public function edit(Cost $cost): View - { - $directions = Direction::pluck('name', 'id'); - $educationForms = EducationForm::pluck('name', 'id'); - return view( - 'admin.catalog.direction.cost.edit', - compact( - 'cost', - 'directions', - 'educationForms', - ) - ); - } - - public function update(UpdateCostRequest $request, Cost $cost): RedirectResponse - { - $validated = $request->validated(); - - $cost->position = $validated['position']; - $cost->description = $validated['description']; - $cost->cost = $validated['cost']; - $cost->education_form_id = $validated['education_form_id']; - $cost->direction_id = $validated['direction_id']; - $cost->save(); - - return redirect()->route('costs.index'); - } - - public function destroy(Cost $cost): RedirectResponse - { - $cost->delete(); - return redirect()->route('costs.index'); - } -} diff --git a/app/Http/Controllers/admin/Catalog/Direction/PeriodController.php b/app/Http/Controllers/admin/Catalog/Direction/PeriodController.php deleted file mode 100644 index 77c5ede..0000000 --- a/app/Http/Controllers/admin/Catalog/Direction/PeriodController.php +++ /dev/null @@ -1,88 +0,0 @@ -validated(); - - $period = new Period(); - $period->position = $validated['position']; - $period->description = $validated['description']; - $period->period = $validated['period']; - $period->education_form_id = $validated['education_form_id']; - $period->direction_id = $validated['direction_id']; - $period->save(); - - return redirect()->route('periods.index'); - } - - public function show(Period $period): View - { - return view('admin.catalog.direction.period.show', compact('period')); - } - - public function edit(Period $period): View - { - $directions = Direction::pluck('name', 'id'); - $educationForms = EducationForm::pluck('name', 'id'); - return view( - 'admin.catalog.direction.period.edit', - compact( - 'period', - 'directions', - 'educationForms', - ) - ); - } - - public function update(UpdatePeriodRequest $request, Period $period): RedirectResponse - { - $validated = $request->validated(); - - $period->position = $validated['position']; - $period->description = $validated['description']; - $period->period = $validated['period']; - $period->education_form_id = $validated['education_form_id']; - $period->direction_id = $validated['direction_id']; - $period->save(); - - return redirect()->route('periods.index'); - } - - public function destroy(Period $period): RedirectResponse - { - $period->delete(); - return redirect()->route('periods.index'); - } -} diff --git a/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php b/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php deleted file mode 100644 index 26c5cf3..0000000 --- a/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php +++ /dev/null @@ -1,97 +0,0 @@ -validated(); - - $place = new Place(); - $place->position = $validated['position']; - $place->description = $validated['description']; - $place->amount = $validated['amount']; - $place->quota = $validated['quota']; - $place->education_form_id = $validated['education_form_id']; - $place->place_type_id = $validated['place_type_id']; - $place->direction_id = $validated['direction_id']; - $place->save(); - - return redirect()->route('places.index'); - } - - public function show(Place $place): View - { - return view('admin.catalog.direction.place.show', compact('place')); - } - - public function edit(Place $place): View - { - $directions = Direction::pluck('name', 'id'); - $placeTypes = PlaceType::pluck('name', 'id'); - $educationForms = EducationForm::pluck('name', 'id'); - return view( - 'admin.catalog.direction.place.edit', - compact( - 'place', - 'directions', - 'placeTypes', - 'educationForms', - ) - ); - } - - public function update(UpdatePlaceRequest $request, Place $place): RedirectResponse - { - $validated = $request->validated(); - - $place->position = $validated['position']; - $place->description = $validated['description']; - $place->amount = $validated['amount']; - $place->quota = $validated['quota']; - $place->education_form_id = $validated['education_form_id']; - $place->place_type_id = $validated['place_type_id']; - $place->direction_id = $validated['direction_id']; - $place->save(); - - return redirect()->route('places.index'); - } - - public function destroy(Place $place): RedirectResponse - { - $place->delete(); - return redirect()->route('places.index'); - } -} diff --git a/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php b/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php deleted file mode 100644 index b87c5ec..0000000 --- a/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php +++ /dev/null @@ -1,70 +0,0 @@ -validated(); - - $type = new PlaceType(); - $type->name = $validated['name']; - $type->description = $validated['description']; - $type->slug = $validated['slug']; - $type->position = $validated['position']; - $type->save(); - - return redirect()->route('place_types.index'); - } - - public function show(PlaceType $placeType): View - { - return view('admin.catalog.direction.place_type.show', compact('placeType')); - } - - public function edit(PlaceType $placeType): View - { - return view('admin.catalog.direction.place_type.edit', compact('placeType')); - } - - public function update(UpdatePlaceTypeRequest $request, PlaceType $placeType): RedirectResponse - { - $validated = $request->validated(); - - $placeType->name = $validated['name']; - $placeType->description = $validated['description']; - $placeType->slug = $validated['slug']; - $placeType->position = $validated['position']; - $placeType->save(); - - return redirect()->route('place_types.index'); - } - - public function destroy(PlaceType $placeType): RedirectResponse - { - if ($placeType->places()->exists()) { - return back(); - } - $placeType->delete(); - return redirect()->route('place_types.index'); - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/StoreCostRequest.php b/app/Http/Requests/admin/Catalog/Direction/StoreCostRequest.php deleted file mode 100644 index 7a40512..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/StoreCostRequest.php +++ /dev/null @@ -1,24 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'cost' => 'required|int|numeric|max:1000000', - 'education_form_id' => 'required|int|numeric|max:255', - 'direction_id' => 'required|int|numeric|max:255', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/StorePeriodRequest.php b/app/Http/Requests/admin/Catalog/Direction/StorePeriodRequest.php deleted file mode 100644 index f3a28ba..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/StorePeriodRequest.php +++ /dev/null @@ -1,24 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'period' => 'required|int|numeric|max:10', - 'education_form_id' => 'required|int|numeric|max:255', - 'direction_id' => 'required|int|numeric|max:255', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php b/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php deleted file mode 100644 index 7abbb1a..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php +++ /dev/null @@ -1,25 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'amount' => 'required|int|numeric|max:255', - 'quota' => 'required|int|numeric|max:255', - 'education_form_id' => 'required|int|numeric|max:255', - 'place_type_id' => 'required|int|numeric|max:255', - 'direction_id' => 'required|int|numeric|max:255', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/StorePlaceTypeRequest.php b/app/Http/Requests/admin/Catalog/Direction/StorePlaceTypeRequest.php deleted file mode 100644 index 311736b..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/StorePlaceTypeRequest.php +++ /dev/null @@ -1,23 +0,0 @@ - 'required|int|numeric|max:255', - 'name' => 'required|string|max:255|unique:place_types,name', - 'description' => 'string', - 'slug' => 'required|string|max:255|unique:place_types,slug', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/UpdateCostRequest.php b/app/Http/Requests/admin/Catalog/Direction/UpdateCostRequest.php deleted file mode 100644 index 9d37a11..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/UpdateCostRequest.php +++ /dev/null @@ -1,24 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'cost' => 'required|int|numeric|max:1000000', - 'education_form_id' => 'required|int|numeric|max:255', - 'direction_id' => 'required|int|numeric|max:255', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/UpdatePeriodRequest.php b/app/Http/Requests/admin/Catalog/Direction/UpdatePeriodRequest.php deleted file mode 100644 index 85b6331..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/UpdatePeriodRequest.php +++ /dev/null @@ -1,24 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'period' => 'required|int|numeric|max:10', - 'education_form_id' => 'required|int|numeric|max:255', - 'direction_id' => 'required|int|numeric|max:255', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php b/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php deleted file mode 100644 index 66c54c5..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php +++ /dev/null @@ -1,25 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'amount' => 'required|int|numeric|max:255', - 'quota' => 'required|int|numeric|max:255', - 'education_form_id' => 'required|int|numeric|max:255', - 'place_type_id' => 'required|int|numeric|max:255', - 'direction_id' => 'required|int|numeric|max:255', - ]; - } -} diff --git a/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceTypeRequest.php b/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceTypeRequest.php deleted file mode 100644 index 9e71114..0000000 --- a/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceTypeRequest.php +++ /dev/null @@ -1,32 +0,0 @@ - 'required|int|numeric|max:255', - 'description' => 'string', - 'slug' => [ - 'string', - 'required', - 'max:255', - "unique:place_types,slug,{$this->place_type->id}", - ], - 'name' => [ - 'required', - 'string', - 'max:255', - "unique:place_types,name,{$this->place_type->id}", - ], - ]; - } -} diff --git a/app/Models/Cost.php b/app/Models/Cost.php deleted file mode 100644 index d5db76b..0000000 --- a/app/Models/Cost.php +++ /dev/null @@ -1,32 +0,0 @@ -belongsTo(Direction::class); - } - - public function educationForm(): BelongsTo - { - return $this->belongsTo(EducationForm::class); - } -} diff --git a/app/Models/Period.php b/app/Models/Period.php deleted file mode 100644 index 9372854..0000000 --- a/app/Models/Period.php +++ /dev/null @@ -1,32 +0,0 @@ -belongsTo(Direction::class); - } - - public function educationForm(): BelongsTo - { - return $this->belongsTo(EducationForm::class); - } -} diff --git a/app/Models/Place.php b/app/Models/Place.php deleted file mode 100644 index 923c122..0000000 --- a/app/Models/Place.php +++ /dev/null @@ -1,38 +0,0 @@ -belongsTo(Direction::class); - } - - public function placeType(): BelongsTo - { - return $this->belongsTo(PlaceType::class); - } - - public function educationForm(): BelongsTo - { - return $this->belongsTo(EducationForm::class); - } -} diff --git a/app/Models/PlaceType.php b/app/Models/PlaceType.php deleted file mode 100644 index ec93888..0000000 --- a/app/Models/PlaceType.php +++ /dev/null @@ -1,25 +0,0 @@ -hasMany('App\Models\Place', 'place_type_id'); - } -} diff --git a/database/factories/CostFactory.php b/database/factories/CostFactory.php deleted file mode 100644 index 611d6d7..0000000 --- a/database/factories/CostFactory.php +++ /dev/null @@ -1,19 +0,0 @@ - 1, - 'description' => fake()->text(), - 'cost' => fake()->randomDigit(), - 'education_form_id' => 1, - 'direction_id' => 1, - ]; - } -} diff --git a/database/factories/PeriodFactory.php b/database/factories/PeriodFactory.php deleted file mode 100644 index 325b7a6..0000000 --- a/database/factories/PeriodFactory.php +++ /dev/null @@ -1,19 +0,0 @@ - 1, - 'description' => fake()->text(), - 'period' => fake()->randomDigit(), - 'education_form_id' => 1, - 'direction_id' => 1, - ]; - } -} diff --git a/database/factories/PlaceFactory.php b/database/factories/PlaceFactory.php deleted file mode 100644 index f8ea851..0000000 --- a/database/factories/PlaceFactory.php +++ /dev/null @@ -1,21 +0,0 @@ - 1, - 'description' => fake()->text(), - 'amount' => fake()->randomDigit(), - 'quota' => fake()->randomDigit(), - 'education_form_id' => 1, - 'place_type_id' => 1, - 'direction_id' => 1, - ]; - } -} diff --git a/database/factories/PlaceTypeFactory.php b/database/factories/PlaceTypeFactory.php deleted file mode 100644 index be3432e..0000000 --- a/database/factories/PlaceTypeFactory.php +++ /dev/null @@ -1,18 +0,0 @@ - fake()->name(), - 'description' => fake()->text(), - 'slug' => fake()->slug(), - 'position' => '1', - ]; - } -} diff --git a/database/migrations/2024_02_19_110021_create_places_table.php b/database/migrations/2024_02_19_110021_create_places_table.php deleted file mode 100644 index ef24b27..0000000 --- a/database/migrations/2024_02_19_110021_create_places_table.php +++ /dev/null @@ -1,34 +0,0 @@ -id(); - $table->integer('position'); - $table->integer('amount'); - $table->integer('quota'); - $table->foreignId('education_form_id')->constrained('education_forms'); - $table->foreignId('place_type_id')->constrained('place_types'); - $table->foreignId('direction_id')->constrained('directions'); - $table->text('description')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('places'); - } -}; diff --git a/database/migrations/2024_02_26_055033_create_costs_table.php b/database/migrations/2024_02_26_055033_create_costs_table.php deleted file mode 100644 index b00033d..0000000 --- a/database/migrations/2024_02_26_055033_create_costs_table.php +++ /dev/null @@ -1,32 +0,0 @@ -id(); - $table->integer('position'); - $table->integer('cost'); - $table->foreignId('education_form_id')->constrained('education_forms'); - $table->foreignId('direction_id')->constrained('directions'); - $table->text('description')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('costs'); - } -}; diff --git a/database/migrations/2024_02_26_080134_create_periods_table.php b/database/migrations/2024_02_26_080134_create_periods_table.php deleted file mode 100644 index 8010a53..0000000 --- a/database/migrations/2024_02_26_080134_create_periods_table.php +++ /dev/null @@ -1,32 +0,0 @@ -id(); - $table->integer('position'); - $table->float('period'); - $table->foreignId('education_form_id')->constrained('education_forms'); - $table->foreignId('direction_id')->constrained('directions'); - $table->text('description')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('periods'); - } -}; diff --git a/database/seeders/CostSeeder.php b/database/seeders/CostSeeder.php deleted file mode 100644 index bf2de4a..0000000 --- a/database/seeders/CostSeeder.php +++ /dev/null @@ -1,30 +0,0 @@ -insert([ - [ - 'position' => 1, - 'cost' => 103000, - 'education_form_id' => 1, - 'direction_id' => 1, - 'description' => 'стоимость обучения 103 000 руб', - ], - [ - 'position' => 2, - 'cost' => 42000, - 'education_form_id' => 2, - 'direction_id' => 1, - 'description' => 'стоимость обучения 42 000 руб', - ], - ]); - } -} diff --git a/database/seeders/PeriodSeeder.php b/database/seeders/PeriodSeeder.php deleted file mode 100644 index e6290ab..0000000 --- a/database/seeders/PeriodSeeder.php +++ /dev/null @@ -1,30 +0,0 @@ -insert([ - [ - 'position' => 1, - 'period' => 4.5, - 'education_form_id' => 1, - 'direction_id' => 1, - 'description' => 'срок обучения 4.5 года', - ], - [ - 'position' => 1, - 'period' => 5, - 'education_form_id' => 2, - 'direction_id' => 1, - 'description' => 'срок обучения 5 года', - ], - ]); - } -} diff --git a/database/seeders/PlaceSeeder.php b/database/seeders/PlaceSeeder.php deleted file mode 100644 index 1ba9973..0000000 --- a/database/seeders/PlaceSeeder.php +++ /dev/null @@ -1,34 +0,0 @@ -insert([ - [ - 'position' => 1, - 'amount' => 25, - 'quota' => 4, - 'education_form_id' => 1, - 'place_type_id' => 1, - 'direction_id' => 1, - 'description' => 'очная бюджетная форма 25 мест юриспруденция', - ], - [ - 'position' => 2, - 'amount' => 30, - 'quota' => 8, - 'education_form_id' => 2, - 'place_type_id' => 2, - 'direction_id' => 1, - 'description' => 'заочная платная форма 30 мест юриспруденция', - ], - ]); - } -} diff --git a/database/seeders/PlaceTypeSeeder.php b/database/seeders/PlaceTypeSeeder.php deleted file mode 100644 index 73e6cb1..0000000 --- a/database/seeders/PlaceTypeSeeder.php +++ /dev/null @@ -1,31 +0,0 @@ -insert([ - [ - 'name' => 'бюджетная', - 'description' => 'бюджетная', - 'slug' => 'budget', - 'position' => '1', - ], - [ - 'name' => 'платная', - 'description' => 'платная', - 'slug' => 'paid', - 'position' => '2', - ], - ]); - } -} diff --git a/resources/views/admin/catalog/direction/cost/create.blade.php b/resources/views/admin/catalog/direction/cost/create.blade.php deleted file mode 100644 index d3c0e4b..0000000 --- a/resources/views/admin/catalog/direction/cost/create.blade.php +++ /dev/null @@ -1,79 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Создать стоимость

- {{ Form::open(['url' => route('costs.store'), 'method' => 'POST', 'class' => '']) }} -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('cost', 'стоимость') }} -
-
- {{ Form::text('cost', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('cost') }} - @endif -
- -
- {{ Form::label('direction_id', 'Направление подготовки') }} -
-
- {{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('direction_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Форма обучения') }} -
-
- {{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- - -
- {{ Form::submit('Создать', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/cost/edit.blade.php b/resources/views/admin/catalog/direction/cost/edit.blade.php deleted file mode 100644 index b25ea6e..0000000 --- a/resources/views/admin/catalog/direction/cost/edit.blade.php +++ /dev/null @@ -1,79 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Изменить Стоимость

- {{ Form::open(['url' => route('costs.update', $cost), 'method' => 'PATCH', 'class' => '']) }} -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', $cost->position, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', $cost->description, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('cost', 'Количество мест') }} -
-
- {{ Form::text('cost', $cost->cost, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('cost') }} - @endif -
- -
- {{ Form::label('direction_id', 'Направление подготовки') }} -
-
- {{ Form::select('direction_id', $directions, $cost->direction->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('direction_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Форма обучения') }} -
-
- {{ Form::select('education_form_id', $educationForms, $cost->educationForm->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- - -
- {{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/cost/index.blade.php b/resources/views/admin/catalog/direction/cost/index.blade.php deleted file mode 100644 index d158ec6..0000000 --- a/resources/views/admin/catalog/direction/cost/index.blade.php +++ /dev/null @@ -1,45 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') -
-

Стоимость

-
- Создать Стоимость -
-
- - - - - - - - - - - - - - @foreach($costs as $cost) - - - - - - - - - @endforeach - -
позицияописаниеФорма обучениянаправлениеСтоимостьдействия
{{ $cost->position }}{{ Str::words($cost->description, 10, '...') }}{{ $cost->educationForm->name }}{{ $cost->direction->name }}{{ $cost->cost }} - посмотреть - редактировать - удалить -
-
-
-
-@endsection diff --git a/resources/views/admin/catalog/direction/cost/show.blade.php b/resources/views/admin/catalog/direction/cost/show.blade.php deleted file mode 100644 index cd265db..0000000 --- a/resources/views/admin/catalog/direction/cost/show.blade.php +++ /dev/null @@ -1,17 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-

позиция

-

{{ $cost->position }}

-

описание

-

{{ $cost->description }}

-

Форма обучения

-

{{ $cost->educationForm->name }}

-

Направление

-

{{ $cost->direction->name }}

-

Стоимость

-

{{ $cost->cost }}

-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/period/create.blade.php b/resources/views/admin/catalog/direction/period/create.blade.php deleted file mode 100644 index 1558286..0000000 --- a/resources/views/admin/catalog/direction/period/create.blade.php +++ /dev/null @@ -1,79 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Создать срок обучения

- {{ Form::open(['url' => route('periods.store'), 'method' => 'POST', 'class' => '']) }} -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('period', 'Срок обучения') }} -
-
- {{ Form::text('period', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('period') }} - @endif -
- -
- {{ Form::label('direction_id', 'Направление подготовки') }} -
-
- {{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('direction_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Форма обучения') }} -
-
- {{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- - -
- {{ Form::submit('Создать', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/period/edit.blade.php b/resources/views/admin/catalog/direction/period/edit.blade.php deleted file mode 100644 index a987f4f..0000000 --- a/resources/views/admin/catalog/direction/period/edit.blade.php +++ /dev/null @@ -1,79 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Изменить Стоимость

- {{ Form::open(['url' => route('periods.update', $period), 'method' => 'PATCH', 'class' => '']) }} -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', $period->position, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', $period->description, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('period', 'Срок обучения') }} -
-
- {{ Form::text('period', $period->period, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('period') }} - @endif -
- -
- {{ Form::label('direction_id', 'Направление подготовки') }} -
-
- {{ Form::select('direction_id', $directions, $period->direction->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('direction_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Форма обучения') }} -
-
- {{ Form::select('education_form_id', $educationForms, $period->educationForm->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- - -
- {{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/period/index.blade.php b/resources/views/admin/catalog/direction/period/index.blade.php deleted file mode 100644 index 604ea08..0000000 --- a/resources/views/admin/catalog/direction/period/index.blade.php +++ /dev/null @@ -1,45 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') -
-

Срок обучения

-
- Создать срок обучения -
-
- - - - - - - - - - - - - - @foreach($periods as $period) - - - - - - - - - @endforeach - -
позицияописаниеФорма обучениянаправлениеСрок обучениядействия
{{ $period->position }}{{ Str::words($period->description, 10, '...') }}{{ $period->educationForm->name }}{{ $period->direction->name }}{{ $period->period }} - посмотреть - редактировать - удалить -
-
-
-
-@endsection diff --git a/resources/views/admin/catalog/direction/period/show.blade.php b/resources/views/admin/catalog/direction/period/show.blade.php deleted file mode 100644 index d9586c4..0000000 --- a/resources/views/admin/catalog/direction/period/show.blade.php +++ /dev/null @@ -1,17 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-

позиция

-

{{ $period->position }}

-

описание

-

{{ $period->description }}

-

Форма обучения

-

{{ $period->educationForm->name }}

-

Направление

-

{{ $period->direction->name }}

-

Срок обучения

-

{{ $period->period }}

-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/place/create.blade.php b/resources/views/admin/catalog/direction/place/create.blade.php deleted file mode 100644 index 296da4d..0000000 --- a/resources/views/admin/catalog/direction/place/create.blade.php +++ /dev/null @@ -1,103 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Создать места

- {{ Form::open(['url' => route('places.store'), 'method' => 'POST', 'class' => '']) }} -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('amount', 'Количество мест') }} -
-
- {{ Form::text('amount', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('amount') }} - @endif -
- -
- {{ Form::label('quota', 'Квота') }} -
-
- {{ Form::text('quota', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('quota') }} - @endif -
- -
- {{ Form::label('direction_id', 'Направление подготовки') }} -
-
- {{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('direction_id') }} - @endif -
- -
- {{ Form::label('place_type_id', 'Тип места') }} -
-
- {{ Form::select('place_type_id', $placeTypes, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('place_type_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Форма обучения') }} -
-
- {{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- - -
- {{ Form::submit('Создать', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/place/edit.blade.php b/resources/views/admin/catalog/direction/place/edit.blade.php deleted file mode 100644 index cdf436b..0000000 --- a/resources/views/admin/catalog/direction/place/edit.blade.php +++ /dev/null @@ -1,103 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Изменить место

- {{ Form::open(['url' => route('places.update', $place), 'method' => 'PATCH', 'class' => '']) }} -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', $place->position, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', $place->description, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('amount', 'Количество мест') }} -
-
- {{ Form::text('amount', $place->amount, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('amount') }} - @endif -
- -
- {{ Form::label('quota', 'Квота') }} -
-
- {{ Form::text('quota', $place->amount, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('quota') }} - @endif -
- -
- {{ Form::label('direction_id', 'Направление подготовки') }} -
-
- {{ Form::select('direction_id', $directions, $place->direction->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('direction_id') }} - @endif -
- -
- {{ Form::label('place_type_id', 'Тип места') }} -
-
- {{ Form::select('place_type_id', $placeTypes, $place->placeType->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('place_type_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Форма обучения') }} -
-
- {{ Form::select('education_form_id', $educationForms, $place->educationForm->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- - -
- {{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/place/index.blade.php b/resources/views/admin/catalog/direction/place/index.blade.php deleted file mode 100644 index 23235e3..0000000 --- a/resources/views/admin/catalog/direction/place/index.blade.php +++ /dev/null @@ -1,49 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') -
-

Места

-
- Создать место -
-
- - - - - - - - - - - - - - - - @foreach($places as $place) - - - - - - - - - - - @endforeach - -
позицияописаниеФорма обученияТип местанаправлениеКол-воКвотадействия
{{ $place->position }}{{ Str::words($place->description, 10, '...') }}{{ $place->educationForm->name }}{{ $place->placeType->name }}{{ $place->direction->name }}{{ $place->amount }}{{ $place->quota }} - посмотреть - редактировать - удалить -
-
-
-
-@endsection diff --git a/resources/views/admin/catalog/direction/place/show.blade.php b/resources/views/admin/catalog/direction/place/show.blade.php deleted file mode 100644 index b520bf6..0000000 --- a/resources/views/admin/catalog/direction/place/show.blade.php +++ /dev/null @@ -1,21 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-

позиция

-

{{ $place->position }}

-

описание

-

{{ $place->description }}

-

Форма обучения

-

{{ $place->educationForm->name }}

-

Тип Места

-

{{ $place->placeType->name }}

-

Направление

-

{{ $place->direction->name }}

-

Кол-во

-

{{ $place->amount }}

-

Квота

-

{{ $place->quota }}

-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/place_type/create.blade.php b/resources/views/admin/catalog/direction/place_type/create.blade.php deleted file mode 100644 index 4aec29f..0000000 --- a/resources/views/admin/catalog/direction/place_type/create.blade.php +++ /dev/null @@ -1,65 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-
-

Создать тип Места

- {{ Form::open(['url' => route('place_types.store'), 'method' => 'POST', 'class' => '']) }} -
-
- {{ Form::label('name', 'Название') }} -
-
- {{ Form::text('name', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('name') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('slug', 'URL') }} -
-
- {{ Form::text('slug', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('slug') }} - @endif -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', '', ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::submit('Создать', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/place_type/edit.blade.php b/resources/views/admin/catalog/direction/place_type/edit.blade.php deleted file mode 100644 index a41f7bf..0000000 --- a/resources/views/admin/catalog/direction/place_type/edit.blade.php +++ /dev/null @@ -1,66 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - - @auth() -
-
-

Изменить тип экзамена

- {{ Form::open(['url' => route('place_types.update', $placeType), 'method' => 'PATCH', 'class' => '']) }} -
-
- {{ Form::label('name', 'Название') }} -
-
- {{ Form::text('name', $placeType->name, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('name') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', $placeType->description, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
- -
- {{ Form::label('slug', 'URL') }} -
-
- {{ Form::text('slug', $placeType->slug, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('slug') }} - @endif -
- -
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', $placeType->position, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }} -
-
- {{ Form::close() }} -
-
- @endauth -@endsection diff --git a/resources/views/admin/catalog/direction/place_type/index.blade.php b/resources/views/admin/catalog/direction/place_type/index.blade.php deleted file mode 100644 index 1f6285e..0000000 --- a/resources/views/admin/catalog/direction/place_type/index.blade.php +++ /dev/null @@ -1,41 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') -
-

Тип Места

-
- Создать тип экзамена -
-
- - - - - - - - - - - - - @foreach($placeTypes as $placeType) - - - - - - - - @endforeach - -
ПозицияНазваниеОписаниеURLдействия
{{ $placeType->position }}{{ $placeType->name }}{{ Str::words($placeType->description, 10, '...') }}{{ $placeType->slug }} - редактировать - удалить -
-
-
-
-@endsection diff --git a/resources/views/admin/catalog/direction/place_type/show.blade.php b/resources/views/admin/catalog/direction/place_type/show.blade.php deleted file mode 100644 index 4f9e14e..0000000 --- a/resources/views/admin/catalog/direction/place_type/show.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@extends('layouts.admin_layout') -@section('content') - @auth() -
-

Название

-

{{ $placeType->name }}

-

Описание

-

{{ $placeType->description }}

-

URL

-

{{ $placeType->slug }}

-

Позиция

-

{{ $placeType->position }}

-

Места

- @foreach($placeType->places as $place) -

{{ $place->name }}

- @endforeach -
- @endauth -@endsection diff --git a/tests/Feature/admin/catalog/direction/CostTest.php b/tests/Feature/admin/catalog/direction/CostTest.php deleted file mode 100644 index d958899..0000000 --- a/tests/Feature/admin/catalog/direction/CostTest.php +++ /dev/null @@ -1,117 +0,0 @@ -create(); - Faculty::factory()->create(); - Department::factory()->create(); - EducationLevel::factory()->create(); - EducationForm::factory()->create(); - Direction::factory()->create(); - - $this->cost = Cost::factory()->create(); - - $this->data = Cost::factory()->make()->only([ - 'position', - 'description', - 'cost', - 'education_form_id', - 'direction_id', - ]); - - $this->user = User::factory()->create([ - 'name' => 'admin', - 'email' => 'test@example.com', - 'password' => 123456 - ]); - } - - public function testIndexCostsPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('costs.index')); - - $response->assertOk(); - } - - public function testCreateCostPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('costs.create')); - - $response->assertOk(); - } - - public function testStoreCost(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->post(route('costs.store', $this->data)); - - $response->assertRedirect(route('costs.index')); - - $this->assertDatabaseHas('costs', $this->data); - } - - public function testShowCost(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('costs.show', $this->cost)); - - $response->assertOk(); - } - - public function testEditCostPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('costs.edit', $this->cost)); - - $response->assertOk(); - } - - public function testUpdateCost(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->patch(route('costs.update', $this->cost), $this->data); - - $response->assertRedirect(route('costs.index')); - - $this->assertDatabaseHas('costs', $this->data); - } - - public function testDestroyCost(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->delete(route('costs.destroy', $this->cost)); - - $response->assertRedirect(route('costs.index')); - - $this->assertDatabaseMissing('costs', $this->cost->toArray()); - } -} diff --git a/tests/Feature/admin/catalog/direction/PeriodTest.php b/tests/Feature/admin/catalog/direction/PeriodTest.php deleted file mode 100644 index 39b5b92..0000000 --- a/tests/Feature/admin/catalog/direction/PeriodTest.php +++ /dev/null @@ -1,116 +0,0 @@ -create(); - Faculty::factory()->create(); - Department::factory()->create(); - EducationLevel::factory()->create(); - EducationForm::factory()->create(); - Direction::factory()->create(); - - $this->period = Period::factory()->create(); - - $this->data = Period::factory()->make()->only([ - 'position', - 'description', - 'period', - 'education_form_id', - 'direction_id', - ]); - - $this->user = User::factory()->create([ - 'name' => 'admin', - 'email' => 'test@example.com', - 'password' => 123456 - ]); - } - - public function testIndexPeriodsPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('periods.index')); - - $response->assertOk(); - } - - public function testCreatePeriodPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('periods.create')); - - $response->assertOk(); - } - - public function testStorePeriod(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->post(route('periods.store', $this->data)); - - $response->assertRedirect(route('periods.index')); - - $this->assertDatabaseHas('periods', $this->data); - } - - public function testShowPeriod(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('periods.show', $this->period)); - - $response->assertOk(); - } - - public function testEditPeriodPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('periods.edit', $this->period)); - - $response->assertOk(); - } - - public function testUpdatePeriod(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->patch(route('periods.update', $this->period), $this->data); - - $response->assertRedirect(route('periods.index')); - - $this->assertDatabaseHas('periods', $this->data); - } - - public function testDestroyPeriod(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->delete(route('periods.destroy', $this->period)); - - $response->assertRedirect(route('periods.index')); - - $this->assertDatabaseMissing('periods', $this->period->toArray()); - } -} diff --git a/tests/Feature/admin/catalog/direction/PlaceTest.php b/tests/Feature/admin/catalog/direction/PlaceTest.php deleted file mode 100644 index cb0a73d..0000000 --- a/tests/Feature/admin/catalog/direction/PlaceTest.php +++ /dev/null @@ -1,120 +0,0 @@ -create(); - EducationalInstitution::factory()->create(); - Faculty::factory()->create(); - Department::factory()->create(); - EducationLevel::factory()->create(); - EducationForm::factory()->create(); - Direction::factory()->create(); - - $this->place = Place::factory()->create(); - - $this->data = Place::factory()->make()->only([ - 'position', - 'description', - 'amount', - 'quota', - 'education_form_id', - 'place_type_id', - 'direction_id', - ]); - - $this->user = User::factory()->create([ - 'name' => 'admin', - 'email' => 'test@example.com', - 'password' => 123456 - ]); - } - - public function testIndexPlacesPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('places.index')); - - $response->assertOk(); - } - - public function testCreatePlacePage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('places.create')); - - $response->assertOk(); - } - - public function testStorePlace(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->post(route('places.store', $this->data)); - - $response->assertRedirect(route('places.index')); - - $this->assertDatabaseHas('places', $this->data); - } - - public function testShowPlacePage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('places.show', $this->place)); - - $response->assertOk(); - } - - public function testEditPlacePage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('places.edit', $this->place)); - - $response->assertOk(); - } - - public function testUpdatePlace(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->patch(route('places.update', $this->place), $this->data); - - $response->assertRedirect(route('places.index')); - - $this->assertDatabaseHas('places', $this->data); - } - - public function testDestroyPlace(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->delete(route('places.destroy', $this->place)); - - $response->assertRedirect(route('places.index')); - - $this->assertDatabaseMissing('places', $this->place->toArray()); - } -} diff --git a/tests/Feature/admin/catalog/direction/PlaceTypeTest.php b/tests/Feature/admin/catalog/direction/PlaceTypeTest.php deleted file mode 100644 index 21f2d7f..0000000 --- a/tests/Feature/admin/catalog/direction/PlaceTypeTest.php +++ /dev/null @@ -1,102 +0,0 @@ -type = PlaceType::factory()->create(); - - $this->data = PlaceType::factory()->make()->only([ - 'name', - 'description', - 'position', - 'slug', - ]); - - $this->user = User::factory()->create([ - 'name' => 'admin', - 'email' => 'test@example.com', - 'password' => 123456 - ]); - } - - public function testIndexPlaceTypesPage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('place_types.index')); - - $response->assertOk(); - } - - public function testCreatePlaceTypePage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('place_types.create')); - - $response->assertOk(); - } - - public function testStorePlaceType(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->post(route('place_types.store', $this->data)); - - $response->assertRedirect(route('place_types.index')); - - $this->assertDatabaseHas('place_types', $this->data); - } - - public function testShowPlaceTypePage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('place_types.show', $this->type)); - - $response->assertOk(); - } - - public function testEditPlaceTypePage(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->get(route('place_types.edit', $this->type)); - - $response->assertOk(); - } - - public function testUpdatePlaceType(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->patch(route('place_types.update', $this->type), $this->data); - - $response->assertRedirect(route('place_types.index')); - - $this->assertDatabaseHas('place_types', $this->data); - } - - public function testDestroyPlaceType(): void - { - $response = $this->actingAs($this->user) - ->withSession(['banned' => false]) - ->delete(route('place_types.destroy', $this->type)); - - $response->assertRedirect(route('place_types.index')); - - $this->assertDatabaseMissing('place_types', $this->type->toArray()); - } -}