From c3e7a0d640e51a84c0065092333c77a91f742620 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Thu, 24 Jun 2021 14:08:08 +0200 Subject: [PATCH] Use ::class notations for routes controllers (#841) * Use class notation. * StyleCI fix. --- src/ShopifyApp/resources/routes/api.php | 10 ++++++---- src/ShopifyApp/resources/routes/shopify.php | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/ShopifyApp/resources/routes/api.php b/src/ShopifyApp/resources/routes/api.php index dd8fe651..4b85f79e 100644 --- a/src/ShopifyApp/resources/routes/api.php +++ b/src/ShopifyApp/resources/routes/api.php @@ -2,6 +2,8 @@ use Illuminate\Support\Facades\Route; use function Osiset\ShopifyApp\getShopifyConfig; +use Osiset\ShopifyApp\Http\Controllers\ApiController; +use Osiset\ShopifyApp\Http\Controllers\WebhookController; use function Osiset\ShopifyApp\registerPackageRoute; // Check if manual routes override is to be use @@ -26,17 +28,17 @@ Route::group(['prefix' => 'api', 'middleware' => ['auth.token']], function () { Route::get( '/', - 'Osiset\ShopifyApp\Http\Controllers\ApiController@index' + ApiController::class.'@index' ); Route::get( '/me', - 'Osiset\ShopifyApp\Http\Controllers\ApiController@getSelf' + ApiController::class.'@getSelf' ); Route::get( '/plans', - 'Osiset\ShopifyApp\Http\Controllers\ApiController@getPlans' + ApiController::class.'@getPlans' ); }); } @@ -53,7 +55,7 @@ if (registerPackageRoute('webhook', $manualRoutes)) { Route::post( '/webhook/{type}', - 'Osiset\ShopifyApp\Http\Controllers\WebhookController@handle' + WebhookController::class.'@handle' ) ->middleware('auth.webhook') ->name(getShopifyConfig('route_names.webhook')); diff --git a/src/ShopifyApp/resources/routes/shopify.php b/src/ShopifyApp/resources/routes/shopify.php index 29b76ce8..58c3ee8b 100644 --- a/src/ShopifyApp/resources/routes/shopify.php +++ b/src/ShopifyApp/resources/routes/shopify.php @@ -11,6 +11,10 @@ use Illuminate\Support\Facades\Route; use function Osiset\ShopifyApp\getShopifyConfig; +use Osiset\ShopifyApp\Http\Controllers\AuthController; +use Osiset\ShopifyApp\Http\Controllers\BillingController; +use Osiset\ShopifyApp\Http\Controllers\HomeController; +use Osiset\ShopifyApp\Http\Controllers\ItpController; use function Osiset\ShopifyApp\registerPackageRoute; // Check if manual routes override is to be use @@ -36,7 +40,7 @@ if (registerPackageRoute('home', $manualRoutes)) { Route::get( '/', - 'Osiset\ShopifyApp\Http\Controllers\HomeController@index' + HomeController::class.'@index' ) ->middleware(['auth.shopify', 'billable']) ->name(getShopifyConfig('route_names.home')); @@ -52,12 +56,12 @@ */ if (registerPackageRoute('itp', $manualRoutes)) { - Route::get('/itp', 'Osiset\ShopifyApp\Http\Controllers\ItpController@attempt') + Route::get('/itp', ItpController::class.'@attempt') ->name(getShopifyConfig('route_names.itp')); } if (registerPackageRoute('itp.ask', $manualRoutes)) { - Route::get('/itp/ask', 'Osiset\ShopifyApp\Http\Controllers\ItpController@ask') + Route::get('/itp/ask', ItpController::class.'@ask') ->name(getShopifyConfig('route_names.itp.ask')); } }); @@ -77,7 +81,7 @@ Route::match( ['get', 'post'], '/authenticate', - 'Osiset\ShopifyApp\Http\Controllers\AuthController@authenticate' + AuthController::class.'@authenticate' ) ->name(getShopifyConfig('route_names.authenticate')); } @@ -94,7 +98,7 @@ if (registerPackageRoute('authenticate.oauth', $manualRoutes)) { Route::get( '/authenticate/oauth', - 'Osiset\ShopifyApp\Http\Controllers\AuthController@oauth' + AuthController::class.'@oauth' ) ->name(getShopifyConfig('route_names.authenticate.oauth')); } @@ -111,7 +115,7 @@ if (registerPackageRoute('billing', $manualRoutes)) { Route::get( '/billing/{plan?}', - 'Osiset\ShopifyApp\Http\Controllers\BillingController@index' + BillingController::class.'@index' ) ->middleware(['auth.shopify']) ->where('plan', '^([0-9]+|)$') @@ -130,7 +134,7 @@ if (registerPackageRoute('billing.process', $manualRoutes)) { Route::get( '/billing/process/{plan?}', - 'Osiset\ShopifyApp\Http\Controllers\BillingController@process' + BillingController::class.'@process' ) ->middleware(['auth.shopify']) ->where('plan', '^([0-9]+|)$') @@ -150,7 +154,7 @@ Route::match( ['get', 'post'], '/billing/usage-charge', - 'Osiset\ShopifyApp\Http\Controllers\BillingController@usageCharge' + BillingController::class.'@usageCharge' ) ->middleware(['auth.shopify']) ->name(getShopifyConfig('route_names.billing.usage_charge'));