Skip to content

Commit

Permalink
allow for turning off api entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoopes committed Nov 16, 2020
1 parent bd12b6e commit ca119c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions config/laravel-vue-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Admin Configuration
*/
'use_web_routes' => env('LVF_USE_WEB_ROUTES', true),
'use_base_api' => env('LVF_USE_BASE_API', true),
'use_admin_api' => env('LVF_USE_ADMIN_API', true),
'admin_middleware' => '',

Expand Down
20 changes: 13 additions & 7 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ protected function mapApiRoutes()
{

if(config('laravel-vue-forms.api_middleware')) {
\Route::prefix(LaravelVueForms::apiPrefix())
->namespace($this->namespace . '\Api')
->middleware(config('laravel-vue-forms.api_middleware'))
->group(base_path('/vendor/jhoopes/laravel-vue-forms') . '/routes/api.php');

if(config('laravel-vue-forms.use_base_api')) {
\Route::prefix(LaravelVueForms::apiPrefix())
->namespace($this->namespace . '\Api')
->middleware(config('laravel-vue-forms.api_middleware'))
->group(base_path('/vendor/jhoopes/laravel-vue-forms') . '/routes/api.php');
}

if(config('laravel-vue-forms.use_admin_api')) {
\Route::prefix(LaravelVueForms::adminApiPrefix())
Expand All @@ -65,9 +68,12 @@ protected function mapApiRoutes()
}

}else {
\Route::prefix(LaravelVueForms::apiPrefix())
->namespace($this->namespace . '\Api')
->group(base_path('/vendor/jhoopes/laravel-vue-forms') . '/routes/api.php');

if(config('laravel-vue-forms.use_base_api')) {
\Route::prefix(LaravelVueForms::apiPrefix())
->namespace($this->namespace . '\Api')
->group(base_path('/vendor/jhoopes/laravel-vue-forms') . '/routes/api.php');
}

if(config('laravel-vue-forms.use_admin_api')) {
\Route::prefix(LaravelVueForms::adminApiPrefix())
Expand Down

0 comments on commit ca119c7

Please sign in to comment.