Files
portal-api/routes/api/admin/customers.php
T
2026-09-28 08:26:29 +07:00

73 lines
4.8 KiB
PHP

<?php
use App\Http\Controllers\Api\Admin\Customer\CustomerController;
use App\Http\Controllers\Api\Admin\Service\ServiceController;
use Illuminate\Support\Facades\Route;
// Customers (module: customer)
Route::prefix('customers')
->controller(CustomerController::class)
->group(function () {
Route::get('trash', 'trash')->middleware('perm:customer.view');
Route::get('vps/available', 'listAvailableVms')->middleware('perm:customer.view');
Route::get('/', 'index')->middleware('perm:customer.view');
Route::post('/', 'store')->middleware('perm:customer.create');
Route::get('{uuid}', 'show')->middleware('perm:customer.view');
Route::put('{uuid}', 'update')->middleware('perm:customer.edit');
Route::delete('{uuid}', 'destroy')->middleware('perm:customer.destroy');
Route::delete('{uuid}/destroy', 'destroy')->middleware('perm:customer.destroy');
Route::post('{uuid}/reset-password', 'resetPassword')->middleware('perm:customer.edit');
Route::post('{uuid}/send-password', 'sendPasswordEmail')->middleware('perm:customer.edit');
Route::post('{uuid}/send-email', 'sendEmail')->middleware('perm:customer.edit');
Route::post('{uuid}/login-as', 'loginAs')->middleware('perm:customer.edit');
Route::post('{uuid}/add-credit', 'addCredit')->middleware('perm:customer.edit');
Route::post('{uuid}/add-total', 'addTotal')->middleware('perm:customer.edit');
Route::get('{uuid}/services', 'getServices')->middleware('perm:customer.view');
Route::post('{uuid}/services', 'createService')->middleware('perm:customer.edit');
Route::post('{uuid}/services/bulk-delete', 'bulkDeleteServices')->middleware(
'perm:customer.edit',
);
Route::put('{uuid}/services/{serviceId}', 'updateService')->middleware('perm:customer.edit');
Route::post('{uuid}/services/{serviceId}/change-ip', 'changeServiceIp')->middleware('perm:customer.edit');
Route::post('{uuid}/services/{serviceId}/change-port', 'changeServicePort')->middleware('perm:customer.edit');
Route::post('{uuid}/services/{serviceId}/notify-renew', 'notifyServiceRenewal')->middleware('perm:customer.edit');
Route::get('{uuid}/notes', 'getCustomerNotes')->middleware('perm:customer.view');
Route::post('{uuid}/notes', 'storeCustomerNote')->middleware('perm:customer.edit');
Route::delete('{uuid}/notes/{noteId}', 'destroyCustomerNote')->middleware('perm:customer.edit');
Route::get('{uuid}/services/{serviceId}/notes', 'getServiceNotes')->middleware('perm:customer.view');
Route::post('{uuid}/services/{serviceId}/notes', 'storeServiceNote')->middleware('perm:customer.edit');
Route::delete('{uuid}/services/{serviceId}/notes/{noteId}', 'destroyServiceNote')->middleware(
'perm:customer.edit',
);
Route::get('{uuid}/orders', 'getOrders')->middleware('perm:customer.view');
Route::put('{uuid}/orders/{orderId}', 'updateOrder')->middleware('perm:customer.edit');
Route::get('{uuid}/invoices', 'getInvoices')->middleware('perm:customer.view');
Route::put('{uuid}/invoices/{invoiceId}', 'updateInvoice')->middleware(
'perm:customer.edit',
);
Route::get('{uuid}/transactions', 'getTransactions')->middleware('perm:customer.view');
Route::put('{uuid}/transactions/{transactionId}', 'updateTransaction')->middleware(
'perm:customer.edit',
);
Route::get('{uuid}/domains', 'getDomains')->middleware('perm:customer.view');
Route::get('{uuid}/dns-domains', 'getDnsDomains')->middleware('perm:customer.view');
Route::get('{uuid}/dns-domains/{domainId}/records', 'getDnsDomainRecords')->middleware(
'perm:customer.view',
);
Route::patch('{uuid}/status', 'updateStatus')->middleware('perm:customer.edit');
Route::post('bulk-delete', 'bulkDelete')->middleware('perm:customer.destroy');
Route::post('bulk-restore', 'bulkRestore')->middleware('perm:customer.edit');
Route::post('bulk-force-delete', 'bulkForceDelete')->middleware('perm:customer.destroy');
Route::post('bulk-status', 'bulkStatus')->middleware('perm:customer.edit');
Route::post('{uuid}/restore', 'restore')->middleware('perm:customer.edit');
Route::delete('{uuid}/force', 'forceDelete')->middleware('perm:customer.destroy');
});
// Services (module: customer)
Route::prefix('services')->controller(ServiceController::class)->group(function () {
Route::get('/', 'index')->middleware('perm:customer.view');
Route::get('{id}', 'show')->middleware('perm:customer.view');
Route::patch('{id}/detach-customer', 'detachCustomer')->middleware('perm:customer.edit');
Route::post('{id}/resend-credentials', 'resendCredentials')->middleware('perm:customer.edit');
});