@@ -121,6 +121,14 @@ final class StylistServiceProvider extends ServiceProvider
|
||||
|
||||
$componentsPath = $themeViewsPath.'/components';
|
||||
|
||||
// Register theme-owned Flux components, including custom icons.
|
||||
// Flux resolves <flux:icon.name> through the flux namespace.
|
||||
$fluxPath = $themeViewsPath.'/flux';
|
||||
|
||||
if (is_dir($fluxPath)) {
|
||||
Blade::anonymousComponentPath($fluxPath, 'flux');
|
||||
}
|
||||
|
||||
// The common theme is the application-wide owner of layouts,
|
||||
// authentication, settings and shared components. Livewire 4
|
||||
// resolves its default full-page layout through layouts::app,
|
||||
@@ -195,6 +203,17 @@ final class StylistServiceProvider extends ServiceProvider
|
||||
// namespace as well as for ordinary view('...') lookups.
|
||||
$this->registerLayoutCompatibilityNamespace($stylist->backend());
|
||||
|
||||
// Livewire 4 resolves class-based component views using a filesystem
|
||||
// path rather than Laravel's themed view finder. Point it at the
|
||||
// selected backend theme so settings components resolve correctly.
|
||||
$backendLivewirePath = $backend->path()
|
||||
.DIRECTORY_SEPARATOR.'views'
|
||||
.DIRECTORY_SEPARATOR.'livewire';
|
||||
|
||||
if (is_dir($backendLivewirePath)) {
|
||||
config()->set('livewire.view_path', $backendLivewirePath);
|
||||
}
|
||||
|
||||
$finder = View::getFinder();
|
||||
$themePaths = [];
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
it('resolves backend theme views', function () {
|
||||
expect(View::exists('dashboard'))->toBeTrue()
|
||||
->and(View::exists('livewire.settings.security'))->toBeTrue()
|
||||
->and(View::exists('livewire.settings.profile'))->toBeTrue();
|
||||
});
|
||||
|
||||
it('registers the custom backend Flux icons', function () {
|
||||
$html = Blade::render(
|
||||
'<flux:icon.folder-git-2 />'
|
||||
);
|
||||
|
||||
expect($html)->toContain('<svg');
|
||||
});
|
||||
|
||||
it('renders the authenticated dashboard', function () {
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('dashboard'))
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
it('renders the authenticated security settings', function () {
|
||||
$this->actingAs(User::factory()->create())
|
||||
->withSession(['auth.password_confirmed_at' => time()])
|
||||
->get(route('security.edit'))
|
||||
->assertOk();
|
||||
});
|
||||
Reference in New Issue
Block a user