F
Filament16mo ago
Shavik

Login Page Blade Override

I'm looking for the proper way to override the default login blade? I'm attempting to get the v3 Filament Socialite package up and running and it's instructions are a bit out of date. It says publish the views and update the login but for one, the v3 docs recommend not publishing all view and even when I tried that, the login.blade.php isn't one of the ones generated. I copied that blade from the vendor directory into my project but I'm unsure of how to properly configure Filament to use that new login blade. Thanks!
Solution:
You need to set a new livewire class that extends the exisitng class and just adjust the render function to load the new view
Jump to solution
7 Replies
Solution
toeknee
toeknee16mo ago
You need to set a new livewire class that extends the exisitng class and just adjust the render function to load the new view
Shavik
ShavikOP16mo ago
Ah, do I need to do anything to make Filament use my new Livewire class?
toeknee
toeknee16mo ago
Yes as per the above link
Shavik
ShavikOP16mo ago
oh right, sorry Looking up the livewire class I need to extend real quick Hmm, I set ->login(Login::class) in my AdminPanelProvider I copied the login.blade.php which looks like this (added line is commented out for now)
<x-filament-panels::page.simple>
@if (filament()->hasRegistration())
<x-slot name="subheading">
{{ __('filament-panels::pages/auth/login.actions.register.before') }}

{{ $this->registerAction }}
</x-slot>
@endif

<x-filament-panels::form wire:submit="authenticate">
{{ $this->form }}

<x-filament-panels::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>
{{-- <x-filament-socialite::buttons /> --}}
</x-filament-panels::form>
</x-filament-panels::page.simple>
<x-filament-panels::page.simple>
@if (filament()->hasRegistration())
<x-slot name="subheading">
{{ __('filament-panels::pages/auth/login.actions.register.before') }}

{{ $this->registerAction }}
</x-slot>
@endif

<x-filament-panels::form wire:submit="authenticate">
{{ $this->form }}

<x-filament-panels::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>
{{-- <x-filament-socialite::buttons /> --}}
</x-filament-panels::form>
</x-filament-panels::page.simple>
Login LW class I made looks like
<?php

namespace App\Livewire\Auth;

use Filament\Pages\Auth\Login as AuthLogin;
use Illuminate\Contracts\View\View;
use Livewire\Component;

class Login extends AuthLogin
{
public function render(): View
{
// return view('livewire.auth.login');
return view('vendor.filament.pages.auth.login');
}
}
<?php

namespace App\Livewire\Auth;

use Filament\Pages\Auth\Login as AuthLogin;
use Illuminate\Contracts\View\View;
use Livewire\Component;

class Login extends AuthLogin
{
public function render(): View
{
// return view('livewire.auth.login');
return view('vendor.filament.pages.auth.login');
}
}
However I get this:
Livewire \ Features \ SupportPageComponents \ MissingLayoutException
PHP 8.1.13
10.18.0
Livewire page component layout view not found: [components.layouts.app]
Livewire \ Features \ SupportPageComponents \ MissingLayoutException
PHP 8.1.13
10.18.0
Livewire page component layout view not found: [components.layouts.app]
toeknee
toeknee16mo ago
You haven't defined the view as per the primary render class as you are missing the layout
Shavik
ShavikOP16mo ago
Right as you said above, I should have set the $view variable and not overridden the render method. Solved now. Well at least this particular part of the issue. Socialite still isn't working but I'll keep working that separately from this thread.
Want results from more Discord servers?
Add your server