Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laravel 11 with fortify login page gives error - Unable to locate a class or view for component [guest-layout]. #51

Open
ramonov opened this issue Jul 10, 2024 · 2 comments

Comments

@ramonov
Copy link

ramonov commented Jul 10, 2024

Larave 11 with fortify package for auth is showing error- unable to locate a class or view for component [guest-layout]
I tried to put the guest-layout page inside resources->views->layouts folder as well but it is not working.
What am i doing wrong here? does your package support laravel 11? Do i need to add middleware at bootstrap->app.php?

@ramonov
Copy link
Author

ramonov commented Jul 10, 2024

tried adding
`<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(DIR))
->withRouting(
web: DIR.'/../routes/web.php',
commands: DIR.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
$middleware->alias([
'theme' => \Qirolab\Theme\Middleware\ThemeMiddleware::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
`

still no luck

@ramonov
Copy link
Author

ramonov commented Jul 10, 2024

I resolved it myself. There is missing folder /app/View/ where component for layouts shall be defined. Missing files are AppLayout.php
`<?php

namespace App\View\Components;

use Illuminate\View\Component;
use Illuminate\View\View;

class AppLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.app');
}
}`
and GuestLayout.php

`<?php

namespace App\View\Components;

use Illuminate\View\Component;
use Illuminate\View\View;

class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.guest');
}
}`
I think this folder is only needed for laravel 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant