add quota at Places Resource

This commit is contained in:
aslan 2024-02-28 15:03:46 +03:00
parent 4ed8dabb19
commit c1dbcc82b3
13 changed files with 38 additions and 2 deletions

View File

@ -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'];

View File

@ -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;

View File

@ -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',

View File

@ -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',

View File

@ -15,6 +15,7 @@ class Place extends Model
'position',
'description',
'amount',
'quota',
'education_form_id',
'place_type_id',
'direction_id',

View File

@ -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,

View File

@ -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');

View File

@ -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,

View File

@ -43,6 +43,18 @@
@endif
</div>
<div class="mt-3">
{{ Form::label('quota', 'Квота') }}
</div>
<div class="mt-1">
{{ Form::text('quota', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('quota') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>

View File

@ -43,6 +43,18 @@
@endif
</div>
<div class="mt-3">
{{ Form::label('quota', 'Квота') }}
</div>
<div class="mt-1">
{{ Form::text('quota', $place->amount, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('quota') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>

View File

@ -15,6 +15,7 @@
<th scope="col">Тип места</th>
<th scope="col">направление</th>
<th scope="col">Кол-во</th>
<th scope="col">Квота</th>
<th scope="col">действия</th>
<th scope="col"></th>
</tr>
@ -28,6 +29,7 @@
<td><a href="{{ route('place_types.show', $place->placeType) }}">{{ $place->placeType->name }}</a></td>
<td><a href="{{ route('directions.show', $place->direction) }}">{{ $place->direction->name }}</a></td>
<td>{{ $place->amount }}</td>
<td>{{ $place->quota }}</td>
<td>
<a href="{{ route("places.show", $place) }}"
class="btn btn-info">посмотреть</a>

View File

@ -14,6 +14,8 @@
<p>{{ $place->direction->name }}</p>
<h2>Кол-во</h2>
<p>{{ $place->amount }}</p>
<h2>Квота</h2>
<p>{{ $place->quota }}</p>
</div>
@endauth
@endsection

View File

@ -36,6 +36,7 @@ class PlaceTest extends TestCase
'position',
'description',
'amount',
'quota',
'education_form_id',
'place_type_id',
'direction_id',