2017-11-03 05:26:07 +00:00
|
|
|
<?php
|
|
|
|
|
2024-07-22 14:13:54 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
use Illuminate\Support\Facades\Route;
|
2022-06-28 11:57:55 +00:00
|
|
|
use Leenooks\Controllers\SwitchUserController;
|
2024-07-04 05:03:11 +00:00
|
|
|
|
2021-07-01 09:41:12 +00:00
|
|
|
use App\Http\Controllers\{AdminController,
|
|
|
|
Auth\LoginController,
|
2021-07-13 05:00:01 +00:00
|
|
|
Auth\SocialLoginController,
|
2024-07-26 02:33:42 +00:00
|
|
|
ChargeController,
|
2021-06-30 23:21:18 +00:00
|
|
|
CheckoutController,
|
2021-06-30 05:50:33 +00:00
|
|
|
HomeController,
|
2022-07-29 06:06:19 +00:00
|
|
|
InvoiceController,
|
2021-07-09 01:39:27 +00:00
|
|
|
OrderController,
|
2024-08-10 00:14:47 +00:00
|
|
|
PaymentController,
|
2021-06-30 05:50:33 +00:00
|
|
|
PaypalController,
|
2022-04-02 07:06:34 +00:00
|
|
|
ProductController,
|
2021-07-02 04:35:43 +00:00
|
|
|
SearchController,
|
2021-07-13 02:31:56 +00:00
|
|
|
ServiceController,
|
2022-06-28 13:20:56 +00:00
|
|
|
SupplierController,
|
2022-08-07 02:17:20 +00:00
|
|
|
UserController,
|
2022-08-01 11:06:57 +00:00
|
|
|
Wholesale\ReportController};
|
2022-06-30 13:51:20 +00:00
|
|
|
use App\Models\Supplier;
|
2021-06-28 01:06:44 +00:00
|
|
|
|
2017-11-03 05:26:07 +00:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
2018-04-10 11:23:13 +00:00
|
|
|
| Web Routes
|
2017-11-03 05:26:07 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
2018-04-10 11:23:13 +00:00
|
|
|
| Here is where you can register web routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| contains the "web" middleware group. Now create something great!
|
2017-11-03 05:26:07 +00:00
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2024-07-24 04:14:11 +00:00
|
|
|
// Global Routes
|
2022-06-28 11:57:55 +00:00
|
|
|
Auth::routes([
|
|
|
|
'login' => true,
|
|
|
|
'logout' => true,
|
|
|
|
'register' => false,
|
|
|
|
'reset' => true, // for resetting passwords
|
|
|
|
'confirm' => false, // for additional password confirmations
|
|
|
|
'verify' => false, // for email verification
|
|
|
|
]);
|
|
|
|
Route::get('logout',[LoginController::class,'logout'])
|
|
|
|
->name('logout-get');
|
2018-04-10 11:23:13 +00:00
|
|
|
|
2024-07-24 04:14:11 +00:00
|
|
|
// Frontend Routes (Non-Authed Users)
|
|
|
|
Route::view('/','theme.frontend.metronic.welcome.home');
|
|
|
|
|
|
|
|
// Logged in users home
|
|
|
|
Route::redirect('home','/u/home');
|
|
|
|
Route::redirect('passkey/loggedin','/u/home');
|
|
|
|
|
|
|
|
Route::get('search',[SearchController::class,'search']);
|
|
|
|
|
|
|
|
Route::get('pay/paypal/authorise',[PaypalController::class,'authorise']);
|
|
|
|
Route::get('pay/paypal/cancel',[PaypalController::class,'cancel']);
|
|
|
|
Route::get('pay/paypal/capture',[PaypalController::class,'capture']);
|
2024-07-22 14:13:54 +00:00
|
|
|
|
2022-04-02 07:06:34 +00:00
|
|
|
// Account linking to OPENID host
|
2024-07-24 04:14:11 +00:00
|
|
|
Route::get('auth/{socialProvider}',[SocialLoginController::class,'redirectToProvider']);
|
|
|
|
Route::get('auth/{socialProvider}/callback',[SocialLoginController::class,'handleProviderCallback']);
|
|
|
|
Route::get('auth/{socialProvider}/token',[SocialLoginController::class,'handleBearerTokenCallback']);
|
2024-08-23 07:28:00 +00:00
|
|
|
Route::get('auth/{socialProvider}/link',[SocialLoginController::class,'link']);
|
|
|
|
Route::post('auth/{socialProvider}/linkcomplete',[SocialLoginController::class,'linkcomplete']);
|
2022-08-12 04:53:06 +00:00
|
|
|
|
2022-06-28 11:57:55 +00:00
|
|
|
// Return from user switch
|
|
|
|
Route::get('admin/switch/stop',[SwitchUserController::class,'switch_stop'])
|
|
|
|
->middleware('auth')
|
|
|
|
->name('switch.stop');
|
2019-09-03 04:43:59 +00:00
|
|
|
|
2022-04-02 07:06:34 +00:00
|
|
|
// Our Admin Routes - for wholesalers
|
2024-07-04 05:03:11 +00:00
|
|
|
Route::group(['middleware'=>['auth','role:wholesaler'],'prefix'=>'a'],function() {
|
2024-07-23 12:17:09 +00:00
|
|
|
// Linking supplier to account
|
|
|
|
Route::post('account/supplier/add/{o}',[UserController::class,'supplier_addedit'])
|
|
|
|
->where('o','[0-9]+');
|
|
|
|
Route::get('account/supplier/delete/{o}/{so}',[UserController::class,'supplier_delete'])
|
|
|
|
->where('o','[0-9]+')
|
|
|
|
->where('so','[0-9]+');
|
|
|
|
|
2021-12-20 03:25:43 +00:00
|
|
|
// Site Setup
|
2024-08-10 12:21:38 +00:00
|
|
|
Route::view('setup','theme.backend.adminlte.setup');
|
2024-07-23 10:22:51 +00:00
|
|
|
Route::post('setup',[AdminController::class,'setup']);
|
2022-06-28 11:57:55 +00:00
|
|
|
|
2022-07-29 06:06:19 +00:00
|
|
|
// Checkout Setup (Payments)
|
2024-08-10 00:14:47 +00:00
|
|
|
Route::view('checkout','theme.backend.adminlte.checkout.choose');
|
|
|
|
Route::view('checkout/new','theme.backend.adminlte.checkout.view');
|
|
|
|
Route::view('checkout/{co}','theme.backend.adminlte.checkout.view')
|
|
|
|
->where('co','[0-9]+');
|
2022-07-29 06:06:19 +00:00
|
|
|
Route::post('checkout/{o?}',[CheckoutController::class,'addedit'])
|
|
|
|
->where('o','[0-9]+');
|
|
|
|
|
2022-04-02 07:06:34 +00:00
|
|
|
// Product Setup
|
2024-08-14 12:16:09 +00:00
|
|
|
Route::view('product','theme.backend.adminlte.product.home');
|
|
|
|
Route::view('product/{pdo}','theme.backend.adminlte.product.details',['breadcrumb'=>['Products'=>'a/product']])
|
|
|
|
->where('pdo','[0-9]+');
|
|
|
|
Route::post('product/{o?}',[ProductController::class,'addedit'])
|
2022-06-28 11:57:55 +00:00
|
|
|
->where('o','[0-9]+');
|
|
|
|
|
2024-08-14 12:16:09 +00:00
|
|
|
Route::get('supplied_products',[ProductController::class,'api_supplied_products']);
|
|
|
|
|
2021-12-20 03:25:43 +00:00
|
|
|
// Supplier Setup
|
2024-08-18 03:58:18 +00:00
|
|
|
Route::view('supplier','theme.backend.adminlte.supplier.home');
|
2024-08-24 07:37:55 +00:00
|
|
|
Route::view('supplier/cost/new/{spo}','theme.backend.adminlte.supplier.cost.add')
|
|
|
|
->where('spo','[0-9]+');
|
|
|
|
Route::post('supplier/cost/new/{spo}',[SupplierController::class,'cost_submit'])
|
|
|
|
->where('spo','[0-9]+');
|
|
|
|
Route::view('supplier/cost/{cso}','theme.backend.adminlte.supplier.cost.view')
|
|
|
|
->where('cso','[0-9]+');
|
2024-08-18 03:58:18 +00:00
|
|
|
Route::view('supplier/details/{spo}','theme.backend.adminlte.supplier.details')
|
|
|
|
->where('spo','[0-9]+');
|
2022-06-28 13:20:56 +00:00
|
|
|
Route::post('supplier/details/{o?}',[SupplierController::class,'addedit'])
|
|
|
|
->where('o','[0-9]+');
|
2024-08-18 03:58:18 +00:00
|
|
|
Route::view('supplier/product/new','theme.backend.adminlte.supplier.product.addedit');
|
|
|
|
Route::view('supplier/product/{spo}/{id}/{type}','theme.backend.adminlte.supplier.product.addedit')
|
|
|
|
->where('spo','[0-9]+')
|
|
|
|
->where('id','[0-9]+')
|
2022-06-30 13:51:20 +00:00
|
|
|
->whereIn('type',Supplier::offeringTypeKeys()->toArray());
|
2024-08-18 03:58:18 +00:00
|
|
|
Route::post('supplier/product/{o}/{oo}/{type}',[SupplierController::class,'product_addedit'])
|
2022-06-30 13:51:20 +00:00
|
|
|
->where('o','[0-9]+')
|
|
|
|
->where('oo','[0-9]+')
|
|
|
|
->whereIn('type',Supplier::offeringTypeKeys()->toArray());
|
|
|
|
Route::post('supplier/product/view/{type}/{oo?}',[SupplierController::class,'product_view_type'])
|
|
|
|
->whereIn('type',Supplier::offeringTypeKeys()->toArray())
|
|
|
|
->where('oo','[0-9]+');
|
2021-07-23 07:25:26 +00:00
|
|
|
|
2023-05-09 07:31:44 +00:00
|
|
|
Route::get('report/accounts',[ReportController::class,'accounts']);
|
2023-05-09 07:50:39 +00:00
|
|
|
Route::get('report/products',[ReportController::class,'products']);
|
2024-07-29 13:12:53 +00:00
|
|
|
Route::view('report/services','theme.backend.adminlte.service.report');
|
2021-10-01 04:59:04 +00:00
|
|
|
|
2022-06-28 11:57:55 +00:00
|
|
|
// Services
|
|
|
|
// @todo This should probably go to resellers - implement a change audit log first
|
2022-08-01 10:34:10 +00:00
|
|
|
Route::post('service/update/{o}',[ServiceController::class,'update'])
|
2022-06-28 11:57:55 +00:00
|
|
|
->where('o','[0-9]+');
|
2017-12-03 01:20:26 +00:00
|
|
|
});
|
2018-05-20 12:53:14 +00:00
|
|
|
|
2018-07-31 04:11:00 +00:00
|
|
|
// Our Reseller Routes
|
2024-07-04 05:03:11 +00:00
|
|
|
Route::group(['middleware'=>['auth','role:reseller'],'prefix'=>'r'],function() {
|
2022-06-28 11:57:55 +00:00
|
|
|
// Enable user switch
|
|
|
|
Route::get('switch/start/{user}',[SwitchUserController::class,'switch_start'])
|
|
|
|
->middleware('can:assume,user')
|
|
|
|
->name('switch.start');
|
2021-07-13 02:31:56 +00:00
|
|
|
|
2022-06-28 11:57:55 +00:00
|
|
|
// Reseller Reports
|
2024-07-26 02:33:42 +00:00
|
|
|
Route::group(['prefix'=>'report'],function() {
|
2024-08-10 13:53:13 +00:00
|
|
|
Route::view('charge/pending','theme.backend.adminlte.charge.pending');
|
2021-07-13 02:31:56 +00:00
|
|
|
Route::get('domain',[ServiceController::class,'domain_list']);
|
2022-04-02 07:06:34 +00:00
|
|
|
Route::get('email',[ServiceController::class,'email_list']);
|
2022-04-02 09:26:59 +00:00
|
|
|
Route::get('hosting',[ServiceController::class,'hosting_list']);
|
2021-07-13 02:31:56 +00:00
|
|
|
});
|
2021-10-01 04:59:04 +00:00
|
|
|
|
2024-08-10 00:14:47 +00:00
|
|
|
Route::post('account/invoices',[InvoiceController::class,'api_account_invoices']);
|
|
|
|
|
2022-06-28 11:57:55 +00:00
|
|
|
// Charges
|
2024-07-26 02:33:42 +00:00
|
|
|
Route::post('charge/addedit',[ChargeController::class,'addedit']);
|
|
|
|
Route::post('charge/delete/{o}',[ChargeController::class,'delete'])
|
|
|
|
->where('o','[0-9]+');
|
|
|
|
Route::post('charge/edit',[ChargeController::class,'edit']);
|
2022-06-12 08:32:54 +00:00
|
|
|
|
2024-08-10 00:14:47 +00:00
|
|
|
// Payments
|
|
|
|
Route::view('payment/new','theme.backend.adminlte.payment.view');
|
|
|
|
Route::view('payment/{po}','theme.backend.adminlte.payment.view')
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:update,po')
|
2024-08-10 00:14:47 +00:00
|
|
|
->where('po','[0-9]+');
|
|
|
|
Route::post('payment/{o?}',[PaymentController::class,'addedit'])
|
|
|
|
->where('o','[0-9]+');
|
|
|
|
Route::view('payment/unapplied','theme.backend.adminlte.payment.unapplied');
|
|
|
|
|
2022-06-12 08:32:54 +00:00
|
|
|
// Reseller API calls
|
|
|
|
Route::post('service_change_charges/{o}',[ServiceController::class,'service_change_charges_display'])
|
|
|
|
->where('o','[0-9]+');
|
2018-07-31 04:11:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Our User Routes
|
2024-07-04 05:03:11 +00:00
|
|
|
Route::group(['middleware'=>['auth'],'prefix'=>'u'],function() {
|
2021-06-28 01:06:44 +00:00
|
|
|
Route::get('home',[HomeController::class,'home']);
|
2021-06-29 06:36:34 +00:00
|
|
|
Route::get('home/{o}',[HomeController::class,'home'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:view,o')
|
|
|
|
->where('o','[0-9]+');
|
2024-08-10 12:17:21 +00:00
|
|
|
|
|
|
|
Route::view('checkout/cart','theme.backend.adminlte.checkout.cart');
|
|
|
|
Route::get('checkout/cart/{o}',[CheckoutController::class,'cart_invoice'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:view,o')
|
|
|
|
->where('o','[0-9]+');
|
2024-08-10 12:17:21 +00:00
|
|
|
Route::post('checkout/cart/remove',[CheckoutController::class,'cart_remove']);
|
|
|
|
Route::post('checkout/fee',[CheckoutController::class,'fee']);
|
|
|
|
Route::post('checkout/pay',[CheckoutController::class,'pay']);
|
|
|
|
|
|
|
|
Route::get('invoice/{o}',[InvoiceController::class,'view'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:view,o')
|
|
|
|
->where('o','[0-9]+');
|
2024-08-10 12:17:21 +00:00
|
|
|
Route::get('invoice/{o}/pdf',[InvoiceController::class,'pdf'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:view,o')
|
|
|
|
->where('o','[0-9]+');
|
2024-08-10 12:17:21 +00:00
|
|
|
|
2022-07-29 07:45:17 +00:00
|
|
|
Route::get('service/{o}',[ServiceController::class,'home'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:view,o')
|
|
|
|
->where('o','[0-9]+');
|
2024-08-17 00:33:56 +00:00
|
|
|
Route::view('service/{so}/cancel-request','theme.backend.adminlte.service.cancel_request')
|
|
|
|
->where('so','[0-9]+');
|
|
|
|
Route::post('service/{o}/cancel-request',[ServiceController::class,'cancel_request'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:progress,o,"cancel-request"')
|
|
|
|
->where('o','[0-9]+');
|
2024-08-17 05:10:50 +00:00
|
|
|
Route::view('service/{so}/change-request','theme.backend.adminlte.service.change_request')
|
|
|
|
->where('so','[0-9]+');
|
|
|
|
Route::post('service/{o}/change-request',[ServiceController::class,'change_request'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:progress,o,"change-request"')
|
|
|
|
->where('o','[0-9]+');
|
2022-06-12 08:32:54 +00:00
|
|
|
// @todo This shouldnt be a user privilege.
|
|
|
|
Route::match(['get','post'],'service/{o}/change-pending',[ServiceController::class,'change_pending'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:progress,o,"change-pending"')
|
|
|
|
->where('o','[0-9]+');
|
2021-09-29 04:57:25 +00:00
|
|
|
Route::get('service/{o}/change/{status}',[ServiceController::class,'change'])
|
2024-08-10 13:53:13 +00:00
|
|
|
->middleware('can:progress,o,status')
|
|
|
|
->where('o','[0-9]+');
|
2024-07-22 14:13:54 +00:00
|
|
|
|
2024-07-24 04:14:11 +00:00
|
|
|
// User settings
|
2024-07-22 14:13:54 +00:00
|
|
|
Route::view('settings','theme.backend.adminlte.user.settings');
|
|
|
|
Route::post('settings/{o}',[UserController::class,'edit']);
|
2018-07-31 04:11:00 +00:00
|
|
|
});
|
|
|
|
|
2020-05-25 07:45:17 +00:00
|
|
|
// Doorman Code Routes
|
2024-07-04 05:03:11 +00:00
|
|
|
Route::group(['prefix'=>'u'],function() {
|
2022-09-29 23:35:58 +00:00
|
|
|
Route::get('invoice/{o}/email/{code}',[InvoiceController::class,'view'])
|
2021-09-29 07:36:55 +00:00
|
|
|
->where('o','[0-9]+')
|
|
|
|
->where('code','[0-9A-Z]{6}');
|
2020-05-25 07:45:17 +00:00
|
|
|
});
|
|
|
|
|
2024-07-24 04:14:11 +00:00
|
|
|
// Frontend
|
2024-07-25 04:09:24 +00:00
|
|
|
Route::view('order','theme.frontend.metronic.order.home');
|
2024-07-24 04:14:11 +00:00
|
|
|
Route::post('order',[OrderController::class,'submit']);
|
2018-05-20 12:53:14 +00:00
|
|
|
|
2024-08-15 11:30:34 +00:00
|
|
|
Route::view('product_order/{pdo}','theme.frontend.metronic.order.widget.order');
|
|
|
|
Route::view('product_info/{pdo}','theme.frontend.metronic.order.widget.info');
|