Skip to content

Commit

Permalink
remove edit group and category
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Aug 12, 2024
1 parent a5ac29f commit 6127a63
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 196 deletions.
14 changes: 0 additions & 14 deletions app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
14 changes: 0 additions & 14 deletions app/Http/Controllers/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
52 changes: 0 additions & 52 deletions resources/views/categories/edit.blade.php

This file was deleted.

1 change: 0 additions & 1 deletion resources/views/categories/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@

@section('control_buttons')
<x-buttons.back/>
<x-buttons.edit href="{{ route('categories.edit', $category) }}"/>

@if (count($category->entities) === 0)
<form x-data="{ open: false }" class="inline-block" action="{{ route('categories.destroy', $category) }}"
Expand Down
52 changes: 0 additions & 52 deletions resources/views/groups/edit.blade.php

This file was deleted.

1 change: 0 additions & 1 deletion resources/views/groups/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@

@section('control_buttons')
<x-buttons.back/>
<x-buttons.edit href="{{ route('groups.edit', $group) }}"/>

@if (count($group->entities) === 0)
<form x-data="{ open: false }" class="inline-block" action="{{ route('groups.destroy', $group) }}"
Expand Down
4 changes: 2 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
Route::get('refresh', [CategoryManagementController::class, 'update'])->name('refresh');

Route::resource('/', CategoryController::class)->parameters(['' => 'category'])
->except('store', 'create')
->except('store', 'create', 'edit')
->withTrashed();
});
// Groups group
Expand All @@ -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();
});

Expand Down
45 changes: 0 additions & 45 deletions tests/Feature/Http/Controllers/CategoryControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
{
Expand Down
15 changes: 0 additions & 15 deletions tests/Feature/Http/Controllers/GroupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 6127a63

Please sign in to comment.