Skip to content

Commit

Permalink
chore: stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
jevantang committed Mar 26, 2024
1 parent e62a22d commit 50d23f3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions config/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
'stubs' => [
'path' => dirname(__DIR__).'/src/Commands/stubs',
'files' => [
'app/Http/Controllers/setting-controller' => 'app/Http/Controllers/$STUDLY_NAME$SettingController.php',
'app/Providers/provider' => 'app/Providers/$STUDLY_NAME$ServiceProvider.php',
'app/Http/Controllers/setting-controller' => 'app/Http/Controllers/SettingController.php',
'app/Providers/service-provider' => 'app/Providers/PluginServiceProvider.php',
'app/Providers/command-provider' => 'app/Providers/CommandServiceProvider.php',
'app/Providers/route-provider' => 'app/Providers/RouteServiceProvider.php',
'config/config' => 'config/$KEBAB_NAME$.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Plugins\$STUDLY_NAME$\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class $STUDLY_NAME$SettingController extends Controller
class SettingController extends Controller
{
public function index(Request $request)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace $NAMESPACE$\Providers;

use Illuminate\Support\ServiceProvider as BaseServiceProvider;

class $STUDLY_NAME$ServiceProvider extends BaseServiceProvider
class PluginServiceProvider extends BaseServiceProvider
{
/**
* Boot the application events.
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/stubs/app/Providers/sql-provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SqlLogServiceProvider extends ServiceProvider
*/
protected function registerQueryLogger()
{
if (! $this->app['config']->get('app.debug')) {
if (! $this->app['config']->get('app.debug') || $this->app['config']->get('app.env') != 'local') {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/stubs/plugin.json.stub
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"accessPath": "/$KEBAB_NAME$",
"settingsPath": "/$KEBAB_NAME$/setting",
"providers": [
"$PLUGIN_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider",
"$PLUGIN_NAMESPACE$\\$STUDLY_NAME$\\Providers\\PluginServiceProvider",
"$PLUGIN_NAMESPACE$\\$STUDLY_NAME$\\Providers\\RouteServiceProvider"
],
"autoloadFiles": [],
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/stubs/routes/api.stub
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use $PLUGIN_NAMESPACE$\$STUDLY_NAME$\Http\Controllers as ApiController;
use $PLUGIN_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\SettingController;

/*
|--------------------------------------------------------------------------
Expand All @@ -22,7 +22,7 @@ use $PLUGIN_NAMESPACE$\$STUDLY_NAME$\Http\Controllers as ApiController;
*/

// Route::prefix('$KEBAB_NAME$')->name('$KEBAB_NAME$.')->group([], function() {
// Route::get('/', [ApiController\$STUDLY_NAME$SettingController::class, 'index'])->name('index');
// Route::get('/', [SettingController::class, 'index'])->name('index');

// Route::middleware('auth:api')->get('auth', function (Request $request) {
// return $request->user();
Expand Down
10 changes: 5 additions & 5 deletions src/Commands/stubs/routes/web.stub
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

use Illuminate\Support\Facades\Route;
use $PLUGIN_NAMESPACE$\$STUDLY_NAME$\Http\Controllers as WebController;
use $PLUGIN_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\SettingController;

/*
|--------------------------------------------------------------------------
Expand All @@ -21,15 +21,15 @@ use $PLUGIN_NAMESPACE$\$STUDLY_NAME$\Http\Controllers as WebController;
*/

Route::prefix('$KEBAB_NAME$')->name('$KEBAB_NAME$.')->group([], function() {
Route::get('/', [WebController\$STUDLY_NAME$SettingController::class, 'index'])->name('index');
Route::get('settings', [WebController\$STUDLY_NAME$SettingController::class, 'showSettingView'])->name('setting');
Route::post('setting', [WebController\$STUDLY_NAME$SettingController::class, 'saveSetting'])->name('save.setting');
Route::get('/', [SettingController::class, 'index'])->name('index');
Route::get('settings', [SettingController::class, 'showSettingView'])->name('setting');
Route::post('setting', [SettingController::class, 'saveSetting'])->name('save.setting');

// without VerifyCsrfToken
// Route::withoutMiddleware([
// \App\Http\Middleware\EncryptCookies::class,
// \App\Http\Middleware\VerifyCsrfToken::class,
// ])->group(function() {
// Route::get('example', [WebController\$STUDLY_NAME$SettingController::class, 'index'])->name('example');
// Route::get('example', [SettingController::class, 'index'])->name('example');
// });
});

0 comments on commit 50d23f3

Please sign in to comment.