diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 79f2bca..ead0d6a 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -41,20 +41,6 @@ public function show(Category $category) ]); } - /** - * Show the form for editing the specified resource. - * - * @return \Illuminate\Http\Response - */ - public function edit(Category $category) - { - $this->authorize('do-everything'); - - return view('categories.edit', [ - 'category' => $category, - ]); - } - /** * Update the specified resource in storage. * diff --git a/app/Http/Controllers/GroupController.php b/app/Http/Controllers/GroupController.php index a6d3240..be5fdcb 100644 --- a/app/Http/Controllers/GroupController.php +++ b/app/Http/Controllers/GroupController.php @@ -41,20 +41,6 @@ public function show(Group $group) ]); } - /** - * Show the form for editing the specified resource. - * - * @return \Illuminate\Http\Response - */ - public function edit(Group $group) - { - $this->authorize('do-everything'); - - return view('groups.edit', [ - 'group' => $group, - ]); - } - /** * Update the specified resource in storage. * diff --git a/resources/views/categories/edit.blade.php b/resources/views/categories/edit.blade.php deleted file mode 100644 index 39b44cc..0000000 --- a/resources/views/categories/edit.blade.php +++ /dev/null @@ -1,52 +0,0 @@ -@extends('layouts.defaultCreate') -@section('title', __('categories.edit', ['name' => $category->name])) -@section('form_action', route('categories.update', $category) ) -@section('submit_button',__('categories.update')) -@section('profile',__('categories.profile')) - -@section('form_method') - @method('patch') - -@endsection - -@section('specific_fields') - - - type="text" name="name" id="name" maxlength="32" - placeholder="{{ __('categories.name_placeholder') }}" value="{{ $category->name }}" - required - - - - - - - type="text" name="description" id="description" maxlength="255" - placeholder="{{ __('categories.description_placeholder') }}" - value="{{ $category->description }}" required - - - - - - - type="text" name="tagfile" id="tagfile" maxlength="36" - placeholder="{{ __('categories.file_placeholder') }}" value="{{ $category->tagfile }}" - required - - - - - -@endsection - diff --git a/resources/views/categories/show.blade.php b/resources/views/categories/show.blade.php index 1a2b5e3..e02ab8e 100644 --- a/resources/views/categories/show.blade.php +++ b/resources/views/categories/show.blade.php @@ -51,7 +51,6 @@ @section('control_buttons') - @if (count($category->entities) === 0)
$group->name])) -@section('form_action', route('groups.update', $group) ) -@section('submit_button',__('groups.update')) -@section('profile',__('groups.profile')) - -@section('form_method') - @method('patch') - -@endsection - -@section('specific_fields') - - - type="text" name="name" id="name" maxlength="32" - placeholder="{{ __('groups.name_placeholder') }}" value="{{ $group->name }}" required - - - - - - - type="text" name="description" id="description" maxlength="255" - placeholder="{{ __('groups.description_placeholder') }}" - value="{{ $group->description }}" required - - - - - - - - type="text" name="tagfile" id="tagfile" maxlength="36" - placeholder="{{ __('groups.file_placeholder') }}" value="{{ $group->tagfile }}" - required - - - - - -@endsection - diff --git a/resources/views/groups/show.blade.php b/resources/views/groups/show.blade.php index aacfd29..5e09947 100644 --- a/resources/views/groups/show.blade.php +++ b/resources/views/groups/show.blade.php @@ -54,7 +54,6 @@ @section('control_buttons') - @if (count($group->entities) === 0) name('refresh'); Route::resource('/', CategoryController::class)->parameters(['' => 'category']) - ->except('store', 'create') + ->except('store', 'create', 'edit') ->withTrashed(); }); // Groups group @@ -143,7 +143,7 @@ Route::get('refresh', [GroupManagementController::class, 'update'])->name('refresh'); Route::resource('/', GroupController::class)->parameters(['' => 'group']) - ->except('store', 'create') + ->except('store', 'create', 'edit') ->withTrashed(); }); diff --git a/tests/Feature/Http/Controllers/CategoryControllerTest.php b/tests/Feature/Http/Controllers/CategoryControllerTest.php index de14915..7994914 100644 --- a/tests/Feature/Http/Controllers/CategoryControllerTest.php +++ b/tests/Feature/Http/Controllers/CategoryControllerTest.php @@ -39,19 +39,6 @@ public function an_anonymouse_user_isnt_shown_a_categories_detail() $this->assertEquals(route('login'), url()->current()); } - /** @test */ - public function an_anonymouse_user_isnt_shown_a_form_to_edit_an_existing_category() - { - $category = Category::factory()->create(); - - $this - ->followingRedirects() - ->get(route('categories.edit', $category)) - ->assertSeeText('login'); - - $this->assertEquals(route('login'), url()->current()); - } - /** @test */ public function an_anonymouse_user_cannot_edit_an_existing_category() { @@ -130,21 +117,6 @@ public function a_user_isnt_shown_a_categories_detail() $this->assertEquals(route('categories.show', $category), url()->current()); } - /** @test */ - public function a_user_isnt_shown_a_form_to_edit_an_existing_category() - { - $user = User::factory()->create(); - $category = Category::factory()->create(); - - $this - ->actingAs($user) - ->get(route('categories.edit', $category)) - ->assertStatus(403) - ->assertSeeText('This action is unauthorized.'); - - $this->assertEquals(route('categories.edit', $category), url()->current()); - } - /** @test */ public function a_user_cannot_edit_an_existing_category() { @@ -233,23 +205,6 @@ public function an_admin_is_shown_a_categories_details() $this->assertEquals(route('categories.show', $category), url()->current()); } - /** @test */ - public function an_admin_is_shown_a_form_to_edit_an_existing_category() - { - $admin = User::factory()->create(['admin' => true]); - $category = Category::factory()->create(); - - $this - ->actingAs($admin) - ->get(route('categories.edit', $category)) - ->assertSeeText(__('categories.profile')) - ->assertSee($category->name) - ->assertSee($category->description) - ->assertSee($category->tagfile); - - $this->assertEquals(route('categories.edit', $category), url()->current()); - } - /** @test */ public function an_admin_can_edit_an_existing_category() { diff --git a/tests/Feature/Http/Controllers/GroupControllerTest.php b/tests/Feature/Http/Controllers/GroupControllerTest.php index 7b4ea5e..7dd7acf 100644 --- a/tests/Feature/Http/Controllers/GroupControllerTest.php +++ b/tests/Feature/Http/Controllers/GroupControllerTest.php @@ -206,21 +206,6 @@ public function an_admin_is_shown_a_groups_details() } /** @test */ - public function an_admin_is_shown_a_form_to_edit_an_existing_group() - { - $admin = User::factory()->create(['admin' => true]); - $group = Group::factory()->create(); - - $this - ->actingAs($admin) - ->get(route('groups.edit', $group)) - ->assertSeeText(__('groups.profile')) - ->assertSee($group->name) - ->assertSee($group->description) - ->assertSee($group->tagfile); - - $this->assertEquals(route('groups.edit', $group), url()->current()); - } /** @test */ public function an_admin_can_edit_an_existing_group()