diff --git a/app/Http/Requests/admin/Catalog/StoreDepartmentRequest.php b/app/Http/Requests/admin/Catalog/StoreDepartmentRequest.php index 2383243..f334a8a 100644 --- a/app/Http/Requests/admin/Catalog/StoreDepartmentRequest.php +++ b/app/Http/Requests/admin/Catalog/StoreDepartmentRequest.php @@ -7,19 +7,11 @@ use Illuminate\Foundation\Http\FormRequest; class StoreDepartmentRequest extends FormRequest { - /** - * Determine if the user is authorized to make this request. - */ public function authorize(): bool { return true; } - /** - * Get the validation rules that apply to the request. - * - * @return array - */ public function rules(): array { return [ diff --git a/app/Http/Requests/admin/Catalog/UpdateDepartmentRequest.php b/app/Http/Requests/admin/Catalog/UpdateDepartmentRequest.php index df0e43c..5f1e5a1 100644 --- a/app/Http/Requests/admin/Catalog/UpdateDepartmentRequest.php +++ b/app/Http/Requests/admin/Catalog/UpdateDepartmentRequest.php @@ -2,7 +2,6 @@ namespace App\Http\Requests\admin\Catalog; -use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class UpdateDepartmentRequest extends FormRequest diff --git a/database/factories/DepartmentFactory.php b/database/factories/DepartmentFactory.php index fdc6c3d..ee96139 100644 --- a/database/factories/DepartmentFactory.php +++ b/database/factories/DepartmentFactory.php @@ -3,8 +3,6 @@ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; -use Illuminate\Support\Facades\Hash; -use Illuminate\Support\Str; class DepartmentFactory extends Factory { diff --git a/database/migrations/2024_02_08_074258_create_departments_table.php b/database/migrations/2024_02_08_074258_create_departments_table.php index 1850030..5ed4aca 100644 --- a/database/migrations/2024_02_08_074258_create_departments_table.php +++ b/database/migrations/2024_02_08_074258_create_departments_table.php @@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema; return new class extends Migration { - /** - * Run the migrations. - */ public function up(): void { Schema::create('departments', function (Blueprint $table) { @@ -22,9 +19,6 @@ return new class extends Migration }); } - /** - * Reverse the migrations. - */ public function down(): void { Schema::dropIfExists('departments'); diff --git a/database/seeders/DepartmentSeeder.php b/database/seeders/DepartmentSeeder.php index 281fa0b..14cf69c 100644 --- a/database/seeders/DepartmentSeeder.php +++ b/database/seeders/DepartmentSeeder.php @@ -2,17 +2,12 @@ namespace Database\Seeders; -use App\Models\Department; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; class DepartmentSeeder extends Seeder { - /** - * Run the database seeds. - */ public function run(): void { DB::table('departments')->insert([ diff --git a/resources/views/admin/catalog/department/edit.blade.php b/resources/views/admin/catalog/department/edit.blade.php index 83ad881..4640148 100644 --- a/resources/views/admin/catalog/department/edit.blade.php +++ b/resources/views/admin/catalog/department/edit.blade.php @@ -1,6 +1,5 @@ @extends('layouts.admin-layout') @section('content') - @auth()
@@ -53,6 +52,18 @@ {{ $errors->first('educational_institution_id') }} @endif
+ +
+ {{ Form::label('slug', 'URL') }} +
+
+ {{ Form::text('slug', $department->slug, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('slug') }} + @endif +
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
diff --git a/resources/views/admin/catalog/department/index.blade.php b/resources/views/admin/catalog/department/index.blade.php index 8d1d651..9c8ff45 100644 --- a/resources/views/admin/catalog/department/index.blade.php +++ b/resources/views/admin/catalog/department/index.blade.php @@ -9,7 +9,6 @@ - @@ -41,5 +40,4 @@

- @endsection diff --git a/tests/Feature/admin/catalog/DepartmentTest.php b/tests/Feature/admin/catalog/DepartmentTest.php index f60e4f3..54fcfa0 100644 --- a/tests/Feature/admin/catalog/DepartmentTest.php +++ b/tests/Feature/admin/catalog/DepartmentTest.php @@ -18,6 +18,7 @@ class DepartmentTest extends TestCase parent::setUp(); EducationalInstitution::factory()->create(); Faculty::factory()->create(); + $this->department = Department::factory()->create(); $this->data = Department::factory()->make()->only([ 'position', @@ -26,12 +27,14 @@ class DepartmentTest extends TestCase 'slug', 'faculty_id', ]); + $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } + public function testIndexDepartmentsPage(): void { $response = $this->actingAs($this->user) @@ -90,7 +93,6 @@ class DepartmentTest extends TestCase $this->assertDatabaseHas('departments', $this->data); } - public function testDestroyDepartment(): void { $response = $this->actingAs($this->user)
Позиция Название Описание