forked from aslan/applicant-site
prodV1 #2
|
@ -7,19 +7,11 @@ use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class StoreDepartmentRequest extends FormRequest
|
class StoreDepartmentRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*/
|
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array<string, ValidationRule|array|string>
|
|
||||||
*/
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Http\Requests\admin\Catalog;
|
namespace App\Http\Requests\admin\Catalog;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class UpdateDepartmentRequest extends FormRequest
|
class UpdateDepartmentRequest extends FormRequest
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class DepartmentFactory extends Factory
|
class DepartmentFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('departments', function (Blueprint $table) {
|
Schema::create('departments', function (Blueprint $table) {
|
||||||
|
@ -22,9 +19,6 @@ return new class extends Migration
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('departments');
|
Schema::dropIfExists('departments');
|
||||||
|
|
|
@ -2,17 +2,12 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Department;
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
||||||
class DepartmentSeeder extends Seeder
|
class DepartmentSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
DB::table('departments')->insert([
|
DB::table('departments')->insert([
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
@extends('layouts.admin-layout')
|
@extends('layouts.admin-layout')
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
@auth()
|
@auth()
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
@ -53,6 +52,18 @@
|
||||||
{{ $errors->first('educational_institution_id') }}
|
{{ $errors->first('educational_institution_id') }}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('slug', 'URL') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('slug', $department->slug, ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('slug') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
||||||
<tr>
|
<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>
|
||||||
|
@ -41,5 +40,4 @@
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -18,6 +18,7 @@ class DepartmentTest extends TestCase
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
EducationalInstitution::factory()->create();
|
EducationalInstitution::factory()->create();
|
||||||
Faculty::factory()->create();
|
Faculty::factory()->create();
|
||||||
|
|
||||||
$this->department = Department::factory()->create();
|
$this->department = Department::factory()->create();
|
||||||
$this->data = Department::factory()->make()->only([
|
$this->data = Department::factory()->make()->only([
|
||||||
'position',
|
'position',
|
||||||
|
@ -26,12 +27,14 @@ class DepartmentTest extends TestCase
|
||||||
'slug',
|
'slug',
|
||||||
'faculty_id',
|
'faculty_id',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->user = User::factory()->create([
|
$this->user = User::factory()->create([
|
||||||
'name' => 'admin',
|
'name' => 'admin',
|
||||||
'email' => 'test@example.com',
|
'email' => 'test@example.com',
|
||||||
'password' => 123456
|
'password' => 123456
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndexDepartmentsPage(): void
|
public function testIndexDepartmentsPage(): void
|
||||||
{
|
{
|
||||||
$response = $this->actingAs($this->user)
|
$response = $this->actingAs($this->user)
|
||||||
|
@ -90,7 +93,6 @@ class DepartmentTest extends TestCase
|
||||||
$this->assertDatabaseHas('departments', $this->data);
|
$this->assertDatabaseHas('departments', $this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testDestroyDepartment(): void
|
public function testDestroyDepartment(): void
|
||||||
{
|
{
|
||||||
$response = $this->actingAs($this->user)
|
$response = $this->actingAs($this->user)
|
||||||
|
|
Loading…
Reference in New Issue