mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-14 11:12:09 -05:00
- Added routes for user profile management including edit, update, and delete functionalities. - Created ProfileController to handle profile-related requests. - Introduced Profile model to manage user profile data. - Developed user status states (Active, Banned, Suspended) with appropriate labels and descriptions. - Implemented favorite listings and sellers functionality in the User model. - Created views for profile editing, updating password, and deleting account. - Added migration for user and profile tables along with necessary fields. - Registered User module with service provider and routes.
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Modules\User\App\Support\Filament;
|
|
|
|
use A909M\FilamentStateFusion\Forms\Components\StateFusionSelect;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
|
|
class UserFormFields
|
|
{
|
|
public static function name(): TextInput
|
|
{
|
|
return TextInput::make('name')->required()->maxLength(255);
|
|
}
|
|
|
|
public static function email(): TextInput
|
|
{
|
|
return TextInput::make('email')->email()->required()->maxLength(255)->unique(ignoreRecord: true);
|
|
}
|
|
|
|
public static function password(callable $requiredCallback): TextInput
|
|
{
|
|
return TextInput::make('password')
|
|
->password()
|
|
->required($requiredCallback)
|
|
->dehydrateStateUsing(fn ($state) => filled($state) ? bcrypt($state) : null)
|
|
->dehydrated(fn ($state) => filled($state));
|
|
}
|
|
|
|
public static function status(): StateFusionSelect
|
|
{
|
|
return StateFusionSelect::make('status')->required();
|
|
}
|
|
|
|
public static function roles(): Select
|
|
{
|
|
return Select::make('roles')->multiple()->relationship('roles', 'name')->preload();
|
|
}
|
|
}
|