I am using Metronic 8.1.7 Laravel and when I try to visit root (/) it automatically redirect to login page. I want to show a landing page and open login page when user click login button. How can I do this?
Looking for reliable garage door repair in FixnGotx? Our expert technicians provide fast, professional service for all your garage door needs. Whether it's a broken spring, off-track door, malfunctioning opener, or routine maintenance, we’ve got you covered. We pride ourselves on delivering top-quality repairs at competitive prices, ensuring your garage door operates smoothly and securely. With years of experience, we guarantee quick response times and lasting solutions. Trust fixngotx company Garage Door Repair for all your residential and commercial garage door services. Call us today for a free estimate and let us keep your garage door in perfect condition!
Hi Mamta,
To help clarify, you can refer to the usage of the < x-base-layout>
component. The < x-error-layout>
component is typically used for displaying 400 or 500 error pages, as shown in the examples. On the other hand, the < x-auth-layout>
component is specifically used for authentication pages like login, registration, and forgot password pages.
In your case, you may want to use the < x-base-layout>
component for your pages. You can find an example of how to use this component in your code. The < x-base-layout>
component is defined in the app/View/Components/BaseLayout.php
file using a Component.
I hope this helps clarify things for you. Let me know if you have any further questions or concerns.
Thanks
Hi Mamta,
To add a custom index page based on the auth layout, you can create a new blade file in the "resources/views/pages
" directory, for example, "my-home-page.blade.php
". Then, wrap your content with the < x-auth-layout>
component like this:
<x-auth-layout>
// Your content here
</x-auth-layout>
array(
"" => array(
"title" => "Dashboard",
"description" => "",
"view" => "my-home-page",
// ...
),
// ...
)
Hi,
Thank you for your reply. I know Metronic 8.1.7 Laravel does not support the CRUD, can you tell me what is the best practice of adding a new page to Laravel? I am using demo1. I want to keep my files separate so that update will not override my files. Is there any documentation for this. There are a lot of files. I found at some we use
<x-base-layout>
<x-error-layout>
<x-auth-layout>
Hi Mamta,
Regarding your question, if you want to make the dashboard accessible without login, you would need to remove the user profile component that displays the avatar at the top bar. You can do this by modifying the code and removing the component from the template. After that, you could consider adding a login button in its place, which would allow users to log in and access the dashboard.
To address the error you mentioned, you need to modify the code in the views/layout/demo1/partials/header/_navbar.blade.php
file. The error seems to be coming from the following line of code:
<img src="{{ auth()->user()->avatarUrl }}" alt="user" />
auth()->check()
function to conditionally display the user avatar in the header based on whether the user is authenticated or not. Here's an example:@if(auth()->check())
<img src="{{ auth()->user()->avatarUrl }}" alt="user" />
@else
<a href="%7B%7B%20route("login")%20%7D%7D" target="_blank" rel="noopener noreferrer">Login</a>
@endif
Thank you for the code. Is it possible to show different view based on auth i.e., if user is logged in or not. May be it is possible to handle this from Middleware.
Hi Mamta,
Could you please let me know which Laravel framework you are using? Are you using the Laravel app or the Laravel starter kit? This information will help me provide you with the appropriate solution.
Thanks!
I download the main folder and used the Laravel folder. What is the difference between these 2. Is there any document for this?
I just checked and found, I am using the Laravel App.
If I remove $route->middleware('auth');
from web.php I get Attempt to read property "avatarUrl" on null
img src="php echo e(auth()->user()->avatarUrl); " alt="user"