skip to Main Content

Laravel 11 delete item with Bootstrap 5 modal – response is string, not object

web.php: Route::delete('/roles/{id}/delete', [RoleController::class, 'delete'])->name('roles.delete'); RoleController.php: public function delete($id): string { $data = [ 'id' => $id ]; return response()->json($data, 200); } index.blade.php: <a href="{{ route('roles.delete', $role->id) }}" class="btn btn-danger btn-xs btn-action" data-bs-toggle="tooltip" data-bs-custom-class="ls-tooltip" title="{{ __('Delete') }}" data-action-message="{{ __('Delete this role?')…

VIEW QUESTION
Back To Top
Search