diff --git a/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php b/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php index 22888a2..26c5cf3 100644 --- a/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php +++ b/app/Http/Controllers/admin/Catalog/Direction/PlaceController.php @@ -43,6 +43,7 @@ class PlaceController extends Controller $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']; @@ -79,6 +80,7 @@ class PlaceController extends Controller $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']; diff --git a/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php b/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php index 74e955b..b87c5ec 100644 --- a/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php +++ b/app/Http/Controllers/admin/Catalog/Direction/PlaceTypeController.php @@ -3,9 +3,7 @@ namespace App\Http\Controllers\admin\Catalog\Direction; use App\Http\Controllers\Controller; -use App\Http\Requests\admin\Catalog\Direction\StoreExaminationTypeRequest; use App\Http\Requests\admin\Catalog\Direction\StorePlaceTypeRequest; -use App\Http\Requests\admin\Catalog\Direction\UpdateExaminationTypeRequest; use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceTypeRequest; use App\Models\PlaceType; use Illuminate\Contracts\View\View; diff --git a/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php b/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php index cb755c8..7abbb1a 100644 --- a/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php +++ b/app/Http/Requests/admin/Catalog/Direction/StorePlaceRequest.php @@ -16,6 +16,7 @@ class StorePlaceRequest extends FormRequest 'position' => '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/UpdatePlaceRequest.php b/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php index 5431012..66c54c5 100644 --- a/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php +++ b/app/Http/Requests/admin/Catalog/Direction/UpdatePlaceRequest.php @@ -16,6 +16,7 @@ class UpdatePlaceRequest extends FormRequest 'position' => '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/Models/Place.php b/app/Models/Place.php index 690f61a..923c122 100644 --- a/app/Models/Place.php +++ b/app/Models/Place.php @@ -15,6 +15,7 @@ class Place extends Model 'position', 'description', 'amount', + 'quota', 'education_form_id', 'place_type_id', 'direction_id', diff --git a/database/factories/PlaceFactory.php b/database/factories/PlaceFactory.php index 2958edc..f8ea851 100644 --- a/database/factories/PlaceFactory.php +++ b/database/factories/PlaceFactory.php @@ -12,6 +12,7 @@ class PlaceFactory extends Factory 'position' => 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/migrations/2024_02_19_110021_create_places_table.php b/database/migrations/2024_02_19_110021_create_places_table.php index dc58ff2..ef24b27 100644 --- a/database/migrations/2024_02_19_110021_create_places_table.php +++ b/database/migrations/2024_02_19_110021_create_places_table.php @@ -15,6 +15,7 @@ return new class extends Migration $table->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'); diff --git a/database/seeders/PlaceSeeder.php b/database/seeders/PlaceSeeder.php index 0984768..1ba9973 100644 --- a/database/seeders/PlaceSeeder.php +++ b/database/seeders/PlaceSeeder.php @@ -14,6 +14,7 @@ class PlaceSeeder extends Seeder [ 'position' => 1, 'amount' => 25, + 'quota' => 4, 'education_form_id' => 1, 'place_type_id' => 1, 'direction_id' => 1, @@ -22,6 +23,7 @@ class PlaceSeeder extends Seeder [ 'position' => 2, 'amount' => 30, + 'quota' => 8, 'education_form_id' => 2, 'place_type_id' => 2, 'direction_id' => 1, diff --git a/resources/views/admin/catalog/direction/place/create.blade.php b/resources/views/admin/catalog/direction/place/create.blade.php index 8252df9..296da4d 100644 --- a/resources/views/admin/catalog/direction/place/create.blade.php +++ b/resources/views/admin/catalog/direction/place/create.blade.php @@ -43,6 +43,18 @@ @endif +
+ {{ Form::label('quota', 'Квота') }} +
+
+ {{ Form::text('quota', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('quota') }} + @endif +
+
{{ Form::label('direction_id', 'Направление подготовки') }}
diff --git a/resources/views/admin/catalog/direction/place/edit.blade.php b/resources/views/admin/catalog/direction/place/edit.blade.php index 0f070d8..cdf436b 100644 --- a/resources/views/admin/catalog/direction/place/edit.blade.php +++ b/resources/views/admin/catalog/direction/place/edit.blade.php @@ -43,6 +43,18 @@ @endif +
+ {{ Form::label('quota', 'Квота') }} +
+
+ {{ Form::text('quota', $place->amount, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('quota') }} + @endif +
+
{{ Form::label('direction_id', 'Направление подготовки') }}
diff --git a/resources/views/admin/catalog/direction/place/index.blade.php b/resources/views/admin/catalog/direction/place/index.blade.php index 845d261..23235e3 100644 --- a/resources/views/admin/catalog/direction/place/index.blade.php +++ b/resources/views/admin/catalog/direction/place/index.blade.php @@ -15,6 +15,7 @@ Тип места направление Кол-во + Квота действия @@ -28,6 +29,7 @@ {{ $place->placeType->name }} {{ $place->direction->name }} {{ $place->amount }} + {{ $place->quota }} посмотреть diff --git a/resources/views/admin/catalog/direction/place/show.blade.php b/resources/views/admin/catalog/direction/place/show.blade.php index ef87b1e..b520bf6 100644 --- a/resources/views/admin/catalog/direction/place/show.blade.php +++ b/resources/views/admin/catalog/direction/place/show.blade.php @@ -14,6 +14,8 @@

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

Кол-во

{{ $place->amount }}

+

Квота

+

{{ $place->quota }}

@endauth @endsection diff --git a/tests/Feature/admin/catalog/direction/PlaceTest.php b/tests/Feature/admin/catalog/direction/PlaceTest.php index da6e082..cb0a73d 100644 --- a/tests/Feature/admin/catalog/direction/PlaceTest.php +++ b/tests/Feature/admin/catalog/direction/PlaceTest.php @@ -36,6 +36,7 @@ class PlaceTest extends TestCase 'position', 'description', 'amount', + 'quota', 'education_form_id', 'place_type_id', 'direction_id',