forked from aslan/applicant-site
reorganization resource Cost, Places, Placetype, Period
This commit is contained in:
parent
f482d036e1
commit
ade2422a4b
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\admin\Catalog\Direction;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\admin\Catalog\Direction\StoreCostRequest;
|
||||
use App\Http\Requests\admin\Catalog\Direction\UpdateCostRequest;
|
||||
use App\Models\Cost;
|
||||
use App\Models\Direction;
|
||||
use App\Models\EducationForm;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class CostController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$costs = Cost::all();
|
||||
return view('admin.catalog.direction.cost.index', compact('costs'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
$directions = Direction::pluck('name', 'id');
|
||||
$educationForms = EducationForm::pluck('name', 'id');
|
||||
return view(
|
||||
'admin.catalog.direction.cost.create',
|
||||
compact(
|
||||
'directions',
|
||||
'educationForms',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function store(StoreCostRequest $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->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');
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\admin\Catalog\Direction;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\admin\Catalog\Direction\StorePeriodRequest;
|
||||
use App\Http\Requests\admin\Catalog\Direction\UpdatePeriodRequest;
|
||||
use App\Models\Direction;
|
||||
use App\Models\EducationForm;
|
||||
use App\Models\Period;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class PeriodController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$periods = Period::all();
|
||||
return view('admin.catalog.direction.period.index', compact('periods'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
$directions = Direction::pluck('name', 'id');
|
||||
$educationForms = EducationForm::pluck('name', 'id');
|
||||
return view(
|
||||
'admin.catalog.direction.period.create',
|
||||
compact(
|
||||
'directions',
|
||||
'educationForms',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function store(StorePeriodRequest $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->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');
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\admin\Catalog\Direction;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\admin\Catalog\Direction\StorePlaceRequest;
|
||||
use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceRequest;
|
||||
use App\Models\Direction;
|
||||
use App\Models\EducationForm;
|
||||
use App\Models\Place;
|
||||
use App\Models\PlaceType;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class PlaceController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$places = Place::all();
|
||||
return view('admin.catalog.direction.place.index', compact('places'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
$directions = Direction::pluck('name', 'id');
|
||||
$placeTypes = PlaceType::pluck('name', 'id');
|
||||
$educationForms = EducationForm::pluck('name', 'id');
|
||||
return view(
|
||||
'admin.catalog.direction.place.create',
|
||||
compact(
|
||||
'directions',
|
||||
'placeTypes',
|
||||
'educationForms',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function store(StorePlaceRequest $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->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');
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\admin\Catalog\Direction;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\admin\Catalog\Direction\StorePlaceTypeRequest;
|
||||
use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceTypeRequest;
|
||||
use App\Models\PlaceType;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class PlaceTypeController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$placeTypes = PlaceType::all();
|
||||
return view('admin.catalog.direction.place_type.index', compact('placeTypes'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
return view('admin.catalog.direction.place_type.create');
|
||||
}
|
||||
|
||||
public function store(StorePlaceTypeRequest $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->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');
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreCostRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => '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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePeriodRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => '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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePlaceRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePlaceTypeRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => '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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateCostRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => '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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdatePeriodRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => '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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdatePlaceRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'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',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\admin\Catalog\Direction;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdatePlaceTypeRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => '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}",
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Cost extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'position',
|
||||
'description',
|
||||
'cost',
|
||||
'education_form_id',
|
||||
'place_type_id',
|
||||
'direction_id',
|
||||
];
|
||||
|
||||
public function direction(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Direction::class);
|
||||
}
|
||||
|
||||
public function educationForm(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EducationForm::class);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Period extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'position',
|
||||
'description',
|
||||
'period',
|
||||
'education_form_id',
|
||||
'place_type_id',
|
||||
'direction_id',
|
||||
];
|
||||
|
||||
public function direction(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Direction::class);
|
||||
}
|
||||
|
||||
public function educationForm(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EducationForm::class);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Place extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'position',
|
||||
'description',
|
||||
'amount',
|
||||
'quota',
|
||||
'education_form_id',
|
||||
'place_type_id',
|
||||
'direction_id',
|
||||
];
|
||||
|
||||
public function direction(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Direction::class);
|
||||
}
|
||||
|
||||
public function placeType(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PlaceType::class);
|
||||
}
|
||||
|
||||
public function educationForm(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EducationForm::class);
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class PlaceType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'slug',
|
||||
'position',
|
||||
];
|
||||
|
||||
public function places(): HasMany
|
||||
{
|
||||
return $this->hasMany('App\Models\Place', 'place_type_id');
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class CostFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'position' => 1,
|
||||
'description' => fake()->text(),
|
||||
'cost' => fake()->randomDigit(),
|
||||
'education_form_id' => 1,
|
||||
'direction_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PeriodFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'position' => 1,
|
||||
'description' => fake()->text(),
|
||||
'period' => fake()->randomDigit(),
|
||||
'education_form_id' => 1,
|
||||
'direction_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PlaceFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'position' => 1,
|
||||
'description' => fake()->text(),
|
||||
'amount' => fake()->randomDigit(),
|
||||
'quota' => fake()->randomDigit(),
|
||||
'education_form_id' => 1,
|
||||
'place_type_id' => 1,
|
||||
'direction_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PlaceTypeFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'description' => fake()->text(),
|
||||
'slug' => fake()->slug(),
|
||||
'position' => '1',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('places', function (Blueprint $table) {
|
||||
$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');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('places');
|
||||
}
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('costs', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('periods', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CostSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('costs')->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 руб',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PeriodSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('periods')->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 года',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PlaceSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('places')->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 мест юриспруденция',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PlaceTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('place_types')->insert([
|
||||
[
|
||||
'name' => 'бюджетная',
|
||||
'description' => 'бюджетная',
|
||||
'slug' => 'budget',
|
||||
'position' => '1',
|
||||
],
|
||||
[
|
||||
'name' => 'платная',
|
||||
'description' => 'платная',
|
||||
'slug' => 'paid',
|
||||
'position' => '2',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class=""> Создать стоимость</h1>
|
||||
{{ Form::open(['url' => route('costs.store'), 'method' => 'POST', 'class' => '']) }}
|
||||
<div class="col">
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('cost', 'стоимость') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('cost', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('cost') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('direction_id', 'Направление подготовки') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('direction_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('education_form_id', 'Форма обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('education_form_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,79 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="">Изменить Стоимость</h1>
|
||||
{{ Form::open(['url' => route('costs.update', $cost), 'method' => 'PATCH', 'class' => '']) }}
|
||||
<div class="col">
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', $cost->position, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', $cost->description, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('cost', 'Количество мест') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('cost', $cost->cost, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('cost') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('direction_id', 'Направление подготовки') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('direction_id', $directions, $cost->direction->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('direction_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('education_form_id', 'Форма обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('education_form_id', $educationForms, $cost->educationForm->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('education_form_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,45 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Стоимость</h2>
|
||||
<br>
|
||||
<a href="{{ route('costs.create') }}" class="btn btn-primary">Создать Стоимость</a>
|
||||
<br>
|
||||
<br>
|
||||
<table class="table">
|
||||
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
||||
<tr>
|
||||
<th scope="col">позиция</th>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($costs as $cost)
|
||||
<tr class="">
|
||||
<td>{{ $cost->position }}</td>
|
||||
<td>{{ Str::words($cost->description, 10, '...') }}</td>
|
||||
<td><a href="{{ route('education_forms.show', $cost->educationForm) }}">{{ $cost->educationForm->name }}</a></td>
|
||||
<td><a href="{{ route('directions.show', $cost->direction) }}">{{ $cost->direction->name }}</a></td>
|
||||
<td>{{ $cost->cost }}</td>
|
||||
<td>
|
||||
<a href="{{ route("costs.show", $cost) }}"
|
||||
class="btn btn-info">посмотреть</a>
|
||||
<a href="{{ route("costs.edit", $cost) }}"
|
||||
class="btn btn-secondary">редактировать</a>
|
||||
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
|
||||
href="{{ route('costs.destroy', $cost) }}"
|
||||
class="btn btn-danger">удалить</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
@endsection
|
|
@ -1,17 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="container mt-4">
|
||||
<h2>позиция</h2>
|
||||
<p>{{ $cost->position }}</p>
|
||||
<h2>описание</h2>
|
||||
<p>{{ $cost->description }}</p>
|
||||
<h2>Форма обучения</h2>
|
||||
<p>{{ $cost->educationForm->name }}</p>
|
||||
<h2>Направление</h2>
|
||||
<p>{{ $cost->direction->name }}</p>
|
||||
<h2>Стоимость</h2>
|
||||
<p>{{ $cost->cost }}</p>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,79 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="">Создать срок обучения</h1>
|
||||
{{ Form::open(['url' => route('periods.store'), 'method' => 'POST', 'class' => '']) }}
|
||||
<div class="col">
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('period', 'Срок обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('period', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('period') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('direction_id', 'Направление подготовки') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('direction_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('education_form_id', 'Форма обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('education_form_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,79 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="">Изменить Стоимость</h1>
|
||||
{{ Form::open(['url' => route('periods.update', $period), 'method' => 'PATCH', 'class' => '']) }}
|
||||
<div class="col">
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', $period->position, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', $period->description, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('period', 'Срок обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('period', $period->period, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('period') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('direction_id', 'Направление подготовки') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('direction_id', $directions, $period->direction->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('direction_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('education_form_id', 'Форма обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('education_form_id', $educationForms, $period->educationForm->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('education_form_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,45 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Срок обучения</h2>
|
||||
<br>
|
||||
<a href="{{ route('periods.create') }}" class="btn btn-primary">Создать срок обучения</a>
|
||||
<br>
|
||||
<br>
|
||||
<table class="table">
|
||||
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
||||
<tr>
|
||||
<th scope="col">позиция</th>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($periods as $period)
|
||||
<tr class="">
|
||||
<td>{{ $period->position }}</td>
|
||||
<td>{{ Str::words($period->description, 10, '...') }}</td>
|
||||
<td><a href="{{ route('education_forms.show', $period->educationForm) }}">{{ $period->educationForm->name }}</a></td>
|
||||
<td><a href="{{ route('directions.show', $period->direction) }}">{{ $period->direction->name }}</a></td>
|
||||
<td>{{ $period->period }}</td>
|
||||
<td>
|
||||
<a href="{{ route("periods.show", $period) }}"
|
||||
class="btn btn-info">посмотреть</a>
|
||||
<a href="{{ route("periods.edit", $period) }}"
|
||||
class="btn btn-secondary">редактировать</a>
|
||||
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
|
||||
href="{{ route('periods.destroy', $period) }}"
|
||||
class="btn btn-danger">удалить</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
@endsection
|
|
@ -1,17 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="container mt-4">
|
||||
<h2>позиция</h2>
|
||||
<p>{{ $period->position }}</p>
|
||||
<h2>описание</h2>
|
||||
<p>{{ $period->description }}</p>
|
||||
<h2>Форма обучения</h2>
|
||||
<p>{{ $period->educationForm->name }}</p>
|
||||
<h2>Направление</h2>
|
||||
<p>{{ $period->direction->name }}</p>
|
||||
<h2>Срок обучения</h2>
|
||||
<p>{{ $period->period }}</p>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,103 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class=""> Создать места</h1>
|
||||
{{ Form::open(['url' => route('places.store'), 'method' => 'POST', 'class' => '']) }}
|
||||
<div class="col">
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('amount', 'Количество мест') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('amount', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('amount') }}
|
||||
@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>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('direction_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('place_type_id', 'Тип места') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('place_type_id', $placeTypes, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('place_type_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('education_form_id', 'Форма обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('education_form_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,103 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="">Изменить место</h1>
|
||||
{{ Form::open(['url' => route('places.update', $place), 'method' => 'PATCH', 'class' => '']) }}
|
||||
<div class="col">
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', $place->position, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', $place->description, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('amount', 'Количество мест') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('amount', $place->amount, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('amount') }}
|
||||
@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>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('direction_id', $directions, $place->direction->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('direction_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('place_type_id', 'Тип места') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('place_type_id', $placeTypes, $place->placeType->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('place_type_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('education_form_id', 'Форма обучения') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::select('education_form_id', $educationForms, $place->educationForm->id, ['class' => 'form-select']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('education_form_id') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,49 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Места</h2>
|
||||
<br>
|
||||
<a href="{{ route('places.create') }}" class="btn btn-primary">Создать место</a>
|
||||
<br>
|
||||
<br>
|
||||
<table class="table">
|
||||
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
||||
<tr>
|
||||
<th scope="col">позиция</th>
|
||||
<th scope="col">описание</th>
|
||||
<th scope="col">Форма обучения</th>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($places as $place)
|
||||
<tr class="">
|
||||
<td>{{ $place->position }}</td>
|
||||
<td>{{ Str::words($place->description, 10, '...') }}</td>
|
||||
<td><a href="{{ route('education_forms.show', $place->educationForm) }}">{{ $place->educationForm->name }}</a></td>
|
||||
<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>
|
||||
<a href="{{ route("places.edit", $place) }}"
|
||||
class="btn btn-secondary">редактировать</a>
|
||||
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
|
||||
href="{{ route('places.destroy', $place) }}"
|
||||
class="btn btn-danger">удалить</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
@endsection
|
|
@ -1,21 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="container mt-4">
|
||||
<h2>позиция</h2>
|
||||
<p>{{ $place->position }}</p>
|
||||
<h2>описание</h2>
|
||||
<p>{{ $place->description }}</p>
|
||||
<h2>Форма обучения</h2>
|
||||
<p>{{ $place->educationForm->name }}</p>
|
||||
<h2>Тип Места</h2>
|
||||
<p>{{ $place->placeType->name }}</p>
|
||||
<h2>Направление</h2>
|
||||
<p>{{ $place->direction->name }}</p>
|
||||
<h2>Кол-во</h2>
|
||||
<p>{{ $place->amount }}</p>
|
||||
<h2>Квота</h2>
|
||||
<p>{{ $place->quota }}</p>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,65 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class=""> Создать тип Места</h1>
|
||||
{{ Form::open(['url' => route('place_types.store'), 'method' => 'POST', 'class' => '']) }}
|
||||
<div class="col">
|
||||
<div class="mt-3">
|
||||
{{ Form::label('name', 'Название') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('name', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('name') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('slug', 'URL') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('slug', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('slug') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,66 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
|
||||
@auth()
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="">Изменить тип экзамена</h1>
|
||||
{{ Form::open(['url' => route('place_types.update', $placeType), 'method' => 'PATCH', 'class' => '']) }}
|
||||
<div class="col">
|
||||
<div class="mt-3">
|
||||
{{ Form::label('name', 'Название') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('name', $placeType->name, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('name') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', $placeType->description, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('slug', 'URL') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('slug', $placeType->slug, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('slug') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('position', $placeType->position, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,41 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Тип Места</h2>
|
||||
<br>
|
||||
<a href="{{ route('place_types.create') }}" class="btn btn-primary">Создать тип экзамена</a>
|
||||
<br>
|
||||
<br>
|
||||
<table class="table">
|
||||
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
||||
<tr>
|
||||
<th scope="col">Позиция</th>
|
||||
<th scope="col">Название</th>
|
||||
<th scope="col">Описание</th>
|
||||
<th scope="col">URL</th>
|
||||
<th scope="col">действия</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($placeTypes as $placeType)
|
||||
<tr class="">
|
||||
<td>{{ $placeType->position }}</td>
|
||||
<td><a href="{{ route('place_types.show', $placeType) }}">{{ $placeType->name }}</a></td>
|
||||
<td>{{ Str::words($placeType->description, 10, '...') }}</td>
|
||||
<td>{{ $placeType->slug }}</td>
|
||||
<td>
|
||||
<a href="{{ route("place_types.edit", $placeType) }}"
|
||||
class="btn btn-secondary">редактировать</a>
|
||||
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
|
||||
href="{{ route('place_types.destroy', $placeType) }}"
|
||||
class="btn btn-danger">удалить</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
@endsection
|
|
@ -1,19 +0,0 @@
|
|||
@extends('layouts.admin_layout')
|
||||
@section('content')
|
||||
@auth()
|
||||
<div class="container mt-4">
|
||||
<h2>Название</h2>
|
||||
<p>{{ $placeType->name }}</p>
|
||||
<h2>Описание</h2>
|
||||
<p>{{ $placeType->description }}</p>
|
||||
<h2>URL</h2>
|
||||
<p>{{ $placeType->slug }}</p>
|
||||
<h2>Позиция</h2>
|
||||
<p>{{ $placeType->position }}</p>
|
||||
<h2>Места</h2>
|
||||
@foreach($placeType->places as $place)
|
||||
<p><a href="{{ route('places.show', $place) }}">{{ $place->name }}</a></p>
|
||||
@endforeach
|
||||
</div>
|
||||
@endauth
|
||||
@endsection
|
|
@ -1,117 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\admin\catalog\direction;
|
||||
|
||||
use App\Models\Cost;
|
||||
use App\Models\Department;
|
||||
use App\Models\Direction;
|
||||
use App\Models\EducationalInstitution;
|
||||
use App\Models\EducationForm;
|
||||
use App\Models\EducationLevel;
|
||||
use App\Models\Faculty;
|
||||
use App\Models\Place;
|
||||
use App\Models\PlaceType;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CostTest extends TestCase
|
||||
{
|
||||
private User $user;
|
||||
private Cost $cost;
|
||||
private array $data;
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
EducationalInstitution::factory()->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());
|
||||
}
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\admin\catalog\direction;
|
||||
|
||||
use App\Models\Cost;
|
||||
use App\Models\Department;
|
||||
use App\Models\Direction;
|
||||
use App\Models\EducationalInstitution;
|
||||
use App\Models\EducationForm;
|
||||
use App\Models\EducationLevel;
|
||||
use App\Models\Faculty;
|
||||
use App\Models\Period;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PeriodTest extends TestCase
|
||||
{
|
||||
private User $user;
|
||||
private Period $period;
|
||||
private array $data;
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
EducationalInstitution::factory()->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());
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\admin\catalog\direction;
|
||||
|
||||
use App\Models\Department;
|
||||
use App\Models\Direction;
|
||||
use App\Models\EducationalInstitution;
|
||||
use App\Models\EducationForm;
|
||||
use App\Models\EducationLevel;
|
||||
use App\Models\EntranceExamination;
|
||||
use App\Models\Faculty;
|
||||
use App\Models\Place;
|
||||
use App\Models\PlaceType;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PlaceTest extends TestCase
|
||||
{
|
||||
private User $user;
|
||||
private Place $place;
|
||||
private array $data;
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
PlaceType::factory()->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());
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\admin\catalog\direction;
|
||||
|
||||
use App\Models\ExaminationType;
|
||||
use App\Models\PlaceType;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PlaceTypeTest extends TestCase
|
||||
{
|
||||
private User $user;
|
||||
private PlaceType $type;
|
||||
private array $data;
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue