feat: initial project setup with Laravel 12 and Filament v4
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Auth;
|
||||
|
||||
use Filament\Auth\Pages\Login as BaseLogin;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use SensitiveParameter;
|
||||
|
||||
class Login extends BaseLogin
|
||||
{
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('username')
|
||||
->label('نام کاربری')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autocomplete('username')
|
||||
->autofocus()
|
||||
->validationMessages([
|
||||
'required' => 'وارد کردن نام کاربری الزامی است.',
|
||||
'max' => 'نام کاربری نباید بیشتر از ۲۵۵ کاراکتر باشد.',
|
||||
]),
|
||||
$this->getPasswordFormComponent()
|
||||
->validationMessages([
|
||||
'required' => 'وارد کردن رمز عبور الزامی است.',
|
||||
]),
|
||||
$this->getRememberFormComponent(),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getCredentialsFromFormData(#[SensitiveParameter] array $data): array
|
||||
{
|
||||
return [
|
||||
'username' => $data['username'],
|
||||
'password' => $data['password'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function throwFailureValidationException(): never
|
||||
{
|
||||
throw ValidationException::withMessages([
|
||||
'data.username' => __('filament-panels::auth/pages/login.messages.failed'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user