Skip to content

Commit 987e17c

Browse files
committed
edit categories page
1 parent e07d7bd commit 987e17c

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

app/Http/Controllers/AddCategoryController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function show(Category $category)
5858
*/
5959
public function edit(Category $category)
6060
{
61-
//
61+
return view('Categories/edit', ['category'=> $category]);
6262
}
6363

6464
/**

resources/views/Blog/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{$category->name}}
1414
@endforeach
1515
</p>
16-
<p><a href="/edit/{{$post->id}}" class="btn btn-success mx-2">edit</a><button type="button" class="btn btn-danger">Delete</button></p>
16+
<p><a href="/edit/{{$post->id}}" class="btn btn-success mx-2">edit</a><a href="/delete" class="btn btn-danger">Delete</a></p>
1717
</div>
1818
</div>
1919
@endforeach

resources/views/Categories/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<tr>
1818
<th scope="row">{{$id}}</th>
1919
<td>{{ $name }}</td>
20-
<td><button type="button" class="btn btn-success">edit</button><button type="button" class="btn btn-danger mx-2">delete</button></td>
20+
<td><a href="{{route('edit-category')}}" class="btn btn-success mx-2">edit</a><a href="/delete/" class="btn btn-danger">Delete</a></td>
2121
</tr>
2222

2323
@endforeach

routes/web.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
return view('Categories/add');
3232
})->name('add-category');
3333

34-
Route::get('/edit-category',function(){
35-
return view('Categories/edit');
36-
})->name('edit-category');
34+
Route::get('/edit-category',[AddCategoryController::class,'edit'])->name('edit-category');
3735

3836
Route::get('/edit-posts',function(){
3937
return view('Blog/edit');

0 commit comments

Comments
 (0)