Skip to content

Commit

Permalink
fix default layout
Browse files Browse the repository at this point in the history
  • Loading branch information
zofe committed Oct 6, 2024
1 parent f8d27d0 commit ed73d6b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/livewire.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

return [
'legacy_model_binding' => true,
'layout' => 'layout::admin'
'layout' => 'layout::frontend'
];
1 change: 1 addition & 0 deletions src/Commands/RapydMakeHomeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function handle()
'class' => "\\".$classNamespace."\\Home",
'routepath' => $routeuri,
'routename' => $routename,
'layout' => 'layout::frontend',
]));

$substituted = $strSubstitutor->replace(file_get_contents(__DIR__.'/Templates/routes/home.stub'));
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Templates/Livewire/Home.stub
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class {{class}} extends {{baseClassName}}
{
public function render()
{
return view('{{view}}');
return view('{{view}}')->layout('{{layout}}');
}
}
2 changes: 1 addition & 1 deletion src/Commands/Templates/routes/home.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


Route::get('{{routepath}}', {{class}}::class)
->middleware(['web','auth'])
->middleware(['web'])
->name('{{routename}}')
->crumbs(fn ($crumbs) => $crumbs->push('Home', route('{{routename}}')));
7 changes: 4 additions & 3 deletions src/Modules/ModuleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
Expand Down Expand Up @@ -79,9 +80,9 @@ private function enableModules(): void
if (File::exists($moduleConfigPath)) {
$this->mergeConfigFrom($moduleConfigPath, $moduleName);
//overrire default layout
if (config($moduleName.'.layout')) {
config(['livewire.layout' => config($moduleName.'.layout')]);
}
// if (config($moduleName.'.layout')) {
// config(['livewire.layout' => config($moduleName.'.layout')]);
// }
}
$this->loadViewsFrom($modulePath . 'Views', $moduleName);
$this->loadViewsFrom($modulePath . 'Livewire', $moduleName);//'components');
Expand Down
3 changes: 3 additions & 0 deletions src/RapydServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Zofe\Rapyd;


use App\Modules\Layout\LayoutServiceProvider;
use Illuminate\Foundation\Http\Events\RequestHandled;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Blade;
Expand Down Expand Up @@ -161,6 +163,7 @@ public function register()

$this->app->register(BreadcrumbsServiceProvider::class);
$this->app->register(ModuleServiceProvider::class);
$this->app->register(LayoutServiceProvider::class);
//$this->app->register(StubGeneratorServiceProvider::class);
}
}

0 comments on commit ed73d6b

Please sign in to comment.