Skip to content

Commit

Permalink
rewrite category from EntityController
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Aug 2, 2024
1 parent fb934bd commit 564776f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions app/Http/Controllers/EntityCategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class EntityCategoryController extends Controller
{
public function store(Entity $entity)
public function update(Entity $entity)
{
$this->authorize('do-everything');

Expand All @@ -21,7 +21,6 @@ public function store(Entity $entity)
$category = Category::findOrFail(request('category'));
$entity->category()->associate($category);
$entity->save();

// TODO work with category (not ready)
/* Bus::chain([
new GitDeleteFromCategory($old_category, $entity, Auth::user()),
Expand Down
3 changes: 1 addition & 2 deletions resources/views/entities/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@
{{ __('common.eduidcz_category') }}
</dt>
<dd class="sm:col-span-2">
<form class="inline-block" action="{{ route('entities.update', $entity) }}" method="post">
<form class="inline-block" action="{{ route('entities.category.update', $entity) }}" method="post">
@csrf
@method('patch')
<input type="hidden" name="action" value="category">
<select class="text-sm rounded" name="category" id="category">
<option value="">{{ __('categories.select_category') }}</option>
@forelse ($categories as $category)
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
Route::post('{entity}/rs', [EntityRsController::class, 'store'])->name('rs.store');
Route::patch('{entity}/rs', [EntityRsController::class, 'rsState'])->name('rs.state')->withTrashed();

Route::post('{entity}/category', [EntityCategoryController::class, 'store'])->name('category.store');
Route::patch('{entity}/category', [EntityCategoryController::class, 'update'])->name('category.update');

Route::get('{entity}/metadata', [EntityMetadataController::class, 'store'])->name('metadata');
Route::get('{entity}/showmetadata', [EntityMetadataController::class, 'show'])->name('showmetadata');
Expand Down

0 comments on commit 564776f

Please sign in to comment.