|
3 | 3 | * Created by PhpStorm.
|
4 | 4 | * User: kgbot
|
5 | 5 | * Date: 6/4/18
|
6 |
| - * Time: 12:18 AM |
| 6 | + * Time: 12:18 AM. |
7 | 7 | */
|
8 |
| - |
9 | 8 | use KgBot\LaravelDeploy\Http\Middleware\IsValidToken;
|
10 | 9 |
|
11 |
| -Route::group( [ |
12 |
| - 'prefix' => config( 'laravel-deploy.routes.prefix' ), |
13 |
| - 'middleware' => array_merge( [ IsValidToken::class ], config( 'laravel-deploy.routes.middleware' ) ), |
| 10 | +Route::group([ |
| 11 | + 'prefix' => config('laravel-deploy.routes.prefix'), |
| 12 | + 'middleware' => array_merge([IsValidToken::class], config('laravel-deploy.routes.middleware')), |
14 | 13 | 'namespace' => 'KgBot\LaravelDeploy\Http\Controllers',
|
15 | 14 |
|
16 | 15 | ], function () {
|
| 16 | + Route::any('deploy', 'DeployController@request')->name('laravel-deploy.deploy.request'); |
| 17 | +}); |
17 | 18 |
|
18 |
| - Route::any( 'deploy', 'DeployController@request' )->name( 'laravel-deploy.deploy.request' ); |
19 |
| -} ); |
20 |
| - |
21 |
| -/** |
| 19 | +/* |
22 | 20 | * Front-end routes
|
23 | 21 | */
|
24 |
| -Route::group( [ |
| 22 | +Route::group([ |
25 | 23 |
|
26 |
| - 'prefix' => config( 'laravel-deploy.routes.prefix' ) . '/dashboard', |
27 |
| - 'middleware' => array_merge( [ 'web', 'auth' ], config( 'laravel-deploy.front.routes.middleware' ) ), |
28 |
| - 'namespace' => config( 'laravel-deploy.front.routes.namespace' ), |
| 24 | + 'prefix' => config('laravel-deploy.routes.prefix').'/dashboard', |
| 25 | + 'middleware' => array_merge(['web', 'auth'], config('laravel-deploy.front.routes.middleware')), |
| 26 | + 'namespace' => config('laravel-deploy.front.routes.namespace'), |
29 | 27 | ], function () {
|
| 28 | + Route::get('', 'DashboardController@index')->name('laravel-deploy.dashboard'); |
| 29 | +}); |
30 | 30 |
|
31 |
| - Route::get( '', 'DashboardController@index' )->name( 'laravel-deploy.dashboard' ); |
32 |
| -} ); |
33 |
| - |
34 |
| -/** |
| 31 | +/* |
35 | 32 | * Ajax routes
|
36 | 33 | */
|
37 |
| -Route::group( [ |
| 34 | +Route::group([ |
38 | 35 |
|
39 |
| - 'prefix' => config( 'laravel-deploy.routes.prefix' ) . '/ajax', |
40 |
| - 'middleware' => array_merge( [ 'web', 'auth' ], config( 'laravel-deploy.front.routes.ajax.middleware' ) ), |
41 |
| - 'namespace' => config( 'laravel-deploy.front.routes.ajax.namespace' ), |
| 36 | + 'prefix' => config('laravel-deploy.routes.prefix').'/ajax', |
| 37 | + 'middleware' => array_merge(['web', 'auth'], config('laravel-deploy.front.routes.ajax.middleware')), |
| 38 | + 'namespace' => config('laravel-deploy.front.routes.ajax.namespace'), |
42 | 39 | ], function () {
|
| 40 | + Route::post('/clients/{client}/status', 'ClientsController@changeStatus') |
| 41 | + ->name('laravel-deploy.ajax.clients.status'); |
43 | 42 |
|
44 |
| - Route::post( '/clients/{client}/status', 'ClientsController@changeStatus' ) |
45 |
| - ->name( 'laravel-deploy.ajax.clients.status' ); |
| 43 | + Route::post('/clients/{client}/auto-deploy', 'ClientsController@changeAutoDeploy') |
| 44 | + ->name('laravel-deploy.ajax.clients.auto_deploy'); |
46 | 45 |
|
47 |
| - Route::post( '/clients/{client}/auto-deploy', 'ClientsController@changeAutoDeploy' ) |
48 |
| - ->name( 'laravel-deploy.ajax.clients.auto_deploy' ); |
| 46 | + Route::resource('/clients', 'ClientsController', [ |
49 | 47 |
|
50 |
| - Route::resource( '/clients', 'ClientsController', [ |
51 |
| - |
52 |
| - 'only' => [ 'index', 'store', 'update', 'destroy' ], |
| 48 | + 'only' => ['index', 'store', 'update', 'destroy'], |
53 | 49 | 'names' => [
|
54 | 50 |
|
55 | 51 | 'index' => 'laravel-deploy.ajax.clients.index',
|
56 | 52 | 'store' => 'laravel-deploy.ajax.clients.store',
|
57 | 53 | 'update' => 'laravel-deploy.ajax.clients.update',
|
58 | 54 | 'destroy' => 'laravel-deploy.ajax.clients.destroy',
|
59 | 55 | ],
|
60 |
| - ] ); |
| 56 | + ]); |
61 | 57 |
|
62 |
| - /** |
| 58 | + /* |
63 | 59 | * Settings routes
|
64 | 60 | */
|
65 |
| - Route::group( [ 'prefix' => 'settings' ], function () { |
66 |
| - |
67 |
| - Route::get( 'last-log', 'SettingsController@lastLog' )->name( 'laravel-deploy.ajax.settings.last_log' ); |
68 |
| - Route::get( 'logs', 'SettingsController@allLogs' )->name( 'laravel-deploy.ajax.settings.logs' ); |
69 |
| - Route::get( 'index', 'SettingsController@index' )->name( 'laravel-deploy.ajax.settings.index' ); |
| 61 | + Route::group(['prefix' => 'settings'], function () { |
| 62 | + Route::get('last-log', 'SettingsController@lastLog')->name('laravel-deploy.ajax.settings.last_log'); |
| 63 | + Route::get('logs', 'SettingsController@allLogs')->name('laravel-deploy.ajax.settings.logs'); |
| 64 | + Route::get('index', 'SettingsController@index')->name('laravel-deploy.ajax.settings.index'); |
70 | 65 |
|
71 |
| - /** |
| 66 | + /* |
72 | 67 | * Deployments routes
|
73 | 68 | */
|
74 |
| - Route::group( [ 'prefix' => 'deployments' ], function () { |
75 |
| - |
76 |
| - Route::post( 'deploy/now/{client}', 'SettingsController@deployNow' ) |
77 |
| - ->name( 'laravel-deploy.ajax.settings.deployments.deploy_now' ); |
| 69 | + Route::group(['prefix' => 'deployments'], function () { |
| 70 | + Route::post('deploy/now/{client}', 'SettingsController@deployNow') |
| 71 | + ->name('laravel-deploy.ajax.settings.deployments.deploy_now'); |
78 | 72 |
|
79 |
| - /** |
| 73 | + /* |
80 | 74 | * Deployment script routes
|
81 | 75 | */
|
82 |
| - Route::get( 'scripts/{client}', 'ClientScriptController@fetch' ) |
83 |
| - ->name( 'laravel-deploy.ajax.settings.deployments.scripts.fetch' ); |
84 |
| - |
85 |
| - Route::post( 'scripts/{client}', 'ClientScriptController@save' ) |
86 |
| - ->name( 'laravel-deploy.ajax.settings.deployments.scripts.save' ); |
87 |
| - } ); |
88 |
| - |
89 |
| - } ); |
90 |
| -} ); |
| 76 | + Route::get('scripts/{client}', 'ClientScriptController@fetch') |
| 77 | + ->name('laravel-deploy.ajax.settings.deployments.scripts.fetch'); |
| 78 | + |
| 79 | + Route::post('scripts/{client}', 'ClientScriptController@save') |
| 80 | + ->name('laravel-deploy.ajax.settings.deployments.scripts.save'); |
| 81 | + }); |
| 82 | + }); |
| 83 | +}); |
0 commit comments