add quota at Places Resource
This commit is contained in:
parent
4ed8dabb19
commit
c1dbcc82b3
|
@ -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'];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -15,6 +15,7 @@ class Place extends Model
|
|||
'position',
|
||||
'description',
|
||||
'amount',
|
||||
'quota',
|
||||
'education_form_id',
|
||||
'place_type_id',
|
||||
'direction_id',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
<p>{{ $place->direction->name }}</p>
|
||||
<h2>Кол-во</h2>
|
||||
<p>{{ $place->amount }}</p>
|
||||
<h2>Квота</h2>
|
||||
<p>{{ $place->quota }}</p>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
||||
|
|
|
@ -36,6 +36,7 @@ class PlaceTest extends TestCase
|
|||
'position',
|
||||
'description',
|
||||
'amount',
|
||||
'quota',
|
||||
'education_form_id',
|
||||
'place_type_id',
|
||||
'direction_id',
|
||||
|
|
Loading…
Reference in New Issue