diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 68f6d7718..cd13b375b 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -2,33 +2,33 @@ namespace App\Providers\Filament; +use Awcodes\FilamentGravatar\GravatarPlugin; +use Awcodes\FilamentGravatar\GravatarProvider; +use BezhanSalleh\FilamentShield\FilamentShieldPlugin; +use Filament\Http\Middleware\Authenticate; +use Filament\Http\Middleware\DisableBladeIconComponents; +use Filament\Http\Middleware\DispatchServingFilamentEvent; use Filament\Pages; use Filament\Panel; -use Filament\Widgets; -use Moox\Jobs\JobsPlugin; -use Moox\Page\PagePlugin; -use Moox\Sync\SyncPlugin; -use Moox\User\UserPlugin; use Filament\PanelProvider; -use Moox\Builder\BuilderPlugin; -use Moox\Jobs\JobsFailedPlugin; -use Moox\Jobs\JobsBatchesPlugin; -use Moox\Jobs\JobsWaitingPlugin; use Filament\Support\Colors\Color; -use Filament\Http\Middleware\Authenticate; -use Jeffgreco13\FilamentBreezy\BreezyCore; -use Awcodes\FilamentGravatar\GravatarPlugin; -use Awcodes\FilamentGravatar\GravatarProvider; -use Illuminate\Session\Middleware\StartSession; +use Filament\Widgets; +use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; use Illuminate\Cookie\Middleware\EncryptCookies; -use BezhanSalleh\FilamentShield\FilamentShieldPlugin; +use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Session\Middleware\AuthenticateSession; +use Illuminate\Session\Middleware\StartSession; use Illuminate\View\Middleware\ShareErrorsFromSession; -use Filament\Http\Middleware\DisableBladeIconComponents; -use Filament\Http\Middleware\DispatchServingFilamentEvent; -use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; -use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; +use Jeffgreco13\FilamentBreezy\BreezyCore; +use Moox\Builder\BuilderPlugin; +use Moox\Jobs\JobsBatchesPlugin; +use Moox\Jobs\JobsFailedPlugin; +use Moox\Jobs\JobsPlugin; +use Moox\Jobs\JobsWaitingPlugin; +use Moox\Page\PagePlugin; +use Moox\Sync\SyncPlugin; +use Moox\User\UserPlugin; class AdminPanelProvider extends PanelProvider { diff --git a/packages/user/src/Models/User.php b/packages/user/src/Models/User.php index fafdd8ff0..dbbe2d4ea 100644 --- a/packages/user/src/Models/User.php +++ b/packages/user/src/Models/User.php @@ -4,20 +4,17 @@ use App\Models\User as BaseUser; use Filament\Models\Contracts\HasAvatar; -use Filament\Models\Contracts\HasName; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Notifications\Notifiable; +use Illuminate\Support\Facades\Storage; use Jeffgreco13\FilamentBreezy\Traits\TwoFactorAuthenticatable; use Spatie\Permission\Traits\HasRoles; -use Illuminate\Support\Facades\Storage; class User extends BaseUser implements HasAvatar { use HasFactory, HasRoles, Notifiable, SoftDeletes, TwoFactorAuthenticatable; - - protected $fillable = [ 'name', 'slug', @@ -30,8 +27,8 @@ class User extends BaseUser implements HasAvatar 'description', 'password', 'profile_photo_path', - - ]; + + ]; protected $searchableFields = ['*']; @@ -49,8 +46,6 @@ class User extends BaseUser implements HasAvatar public function getFilamentAvatarUrl(): ?string { - return $this->avatar_url ? Storage::url($this->avatar_url) : null ; + return $this->avatar_url ? Storage::url($this->avatar_url) : null; } - - } diff --git a/packages/user/src/Resources/UserResource.php b/packages/user/src/Resources/UserResource.php index b3799651d..122043d6c 100644 --- a/packages/user/src/Resources/UserResource.php +++ b/packages/user/src/Resources/UserResource.php @@ -2,33 +2,30 @@ namespace Moox\User\Resources; -use Filament\Forms\Components\Card; -use Livewire\Component; -use Filament\Forms\Form; -use Filament\Tables\Table; -use Moox\User\Models\User; -use Filament\Resources\Resource; +use Filament\Forms\Components\FileUpload; use Filament\Forms\Components\Grid; -use Illuminate\Support\Facades\Hash; -use Filament\Forms\Components\Select; +use Filament\Forms\Components\RichEditor; use Filament\Forms\Components\Section; +use Filament\Forms\Components\Select; +use Filament\Forms\Components\TextInput; +use Filament\Forms\Form; +use Filament\Resources\Resource; +use Filament\Tables\Actions\DeleteBulkAction; use Filament\Tables\Actions\EditAction; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\IconColumn; -use Filament\Tables\Columns\TextColumn; -use Illuminate\Database\Eloquent\Model; -use Filament\Forms\Components\TextInput; use Filament\Tables\Columns\ImageColumn; -use Filament\Forms\Components\FileUpload; -use Filament\Forms\Components\RichEditor; -use Filament\Forms\Components\Split; -use Filament\Tables\Columns\SelectColumn; +use Filament\Tables\Columns\TextColumn; use Filament\Tables\Filters\SelectFilter; -use Filament\Tables\Actions\DeleteBulkAction; +use Filament\Tables\Table; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Hash; +use Livewire\Component; +use Moox\User\Models\User; +use Moox\User\Resources\UserResource\Pages\CreateUser; use Moox\User\Resources\UserResource\Pages\EditUser; -use Moox\User\Resources\UserResource\Pages\ViewUser; use Moox\User\Resources\UserResource\Pages\ListUsers; -use Moox\User\Resources\UserResource\Pages\CreateUser; +use Moox\User\Resources\UserResource\Pages\ViewUser; use STS\FilamentImpersonate\Tables\Actions\Impersonate; class UserResource extends Resource @@ -54,8 +51,7 @@ public static function form(Form $form): Form ]), FileUpload::make('avatar_url'), - - + TextInput::make('name') ->rules(['max:255', 'string']) ->required() @@ -169,8 +165,8 @@ public static function form(Form $form): Form 'md' => 12, 'lg' => 12, ]), - ]), ]), + ]), Section::make()->schema([ Grid::make(['default' => 0])->schema([ @@ -226,8 +222,8 @@ public static function form(Form $form): Form ])->statePath('data'), ]), - - ]); + + ]); } public static function table(Table $table): Table @@ -236,7 +232,7 @@ public static function table(Table $table): Table ->poll('60s') ->columns([ ImageColumn::make('profile_photo_path') - ->defaultImageUrl(fn ($record): string => 'https://ui-avatars.com/api/?name=' . $record->name) + ->defaultImageUrl(fn ($record): string => 'https://ui-avatars.com/api/?name='.$record->name) ->circular() ->toggleable(), TextColumn::make('name') @@ -250,7 +246,7 @@ public static function table(Table $table): Table TextColumn::make('first_name') ->label(__('Fullname')) ->formatStateUsing(function ($state, User $user) { - return $user->first_name . ' ' . $user->last_name; + return $user->first_name.' '.$user->last_name; }) ->toggleable() ->sortable() @@ -260,9 +256,8 @@ public static function table(Table $table): Table ->toggleable() ->searchable() ->limit(50), - IconColumn::make('email_verified_at') - , - TextColumn::make('roles.name'), + IconColumn::make('email_verified_at'), + TextColumn::make('roles.name'), ]) ->filters([ @@ -272,7 +267,7 @@ public static function table(Table $table): Table ->multiple() ->label('Language'), ]) - ->actions([Impersonate::make()->redirectTo(route('filament.moox.pages.profile')),ViewAction::make(), EditAction::make()]) + ->actions([Impersonate::make()->redirectTo(route('filament.moox.pages.profile')), ViewAction::make(), EditAction::make()]) ->bulkActions([DeleteBulkAction::make()]); } diff --git a/packages/user/src/Resources/UserResource/Pages/EditUser.php b/packages/user/src/Resources/UserResource/Pages/EditUser.php index 4f37c5489..c11476904 100644 --- a/packages/user/src/Resources/UserResource/Pages/EditUser.php +++ b/packages/user/src/Resources/UserResource/Pages/EditUser.php @@ -3,8 +3,8 @@ namespace Moox\User\Resources\UserResource\Pages; use Filament\Actions\DeleteAction; -use Moox\User\Resources\UserResource; use Filament\Resources\Pages\EditRecord; +use Moox\User\Resources\UserResource; use STS\FilamentImpersonate\Pages\Actions\Impersonate; class EditUser extends EditRecord @@ -13,6 +13,6 @@ class EditUser extends EditRecord protected function getHeaderActions(): array { - return [DeleteAction::make(),Impersonate::make()->record($this->getRecord())]; + return [DeleteAction::make(), Impersonate::make()->record($this->getRecord())]; } }