mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-14 11:12:09 -05:00
- Fix CI workflow: actions/checkout@v6 → v4
- Install FilamentPHP ^5.0 and spatie/laravel-permission ^7.2
- Remove laravel/breeze from require-dev (replaced by Filament auth)
- Update User model: implements FilamentUser, HasTenants, HasRoles
- Publish Spatie permission migrations for role-based access
- Create Admin module with FilamentPHP panel at /admin
- UserResource, CategoryResource, ListingResource, LocationResource
- Role-based access (admin role required)
- Create Partner module with tenant-isolated panel at /partner/{id}
- ListingResource scoped to authenticated user
- Update modules_statuses.json: add Admin and Partner modules
- Update DatabaseSeeder: create admin/partner users with roles
- Improve seeders: LocationSeeder (10 countries), CategorySeeder (8 categories with children), ListingSeeder (10 sample listings)
- Add Docker support: Dockerfile, docker-compose.yml, docker-compose.dev.yml
- Add GitHub Codespaces: .devcontainer/devcontainer.json
- Update .env.example with Filament-relevant settings
- Update README.md with full documentation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
51 lines
1.9 KiB
PHP
51 lines
1.9 KiB
PHP
<?php
|
|
namespace Modules\Admin\Filament\Resources;
|
|
|
|
use App\Models\User;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables\Actions\DeleteAction;
|
|
use Filament\Tables\Actions\EditAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
use Modules\Admin\Filament\Resources\UserResource\Pages;
|
|
|
|
class UserResource extends Resource
|
|
{
|
|
protected static ?string $model = User::class;
|
|
protected static ?string $navigationIcon = 'heroicon-o-users';
|
|
protected static ?string $navigationGroup = 'User Management';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form->schema([
|
|
TextInput::make('name')->required()->maxLength(255),
|
|
TextInput::make('email')->email()->required()->maxLength(255)->unique(ignoreRecord: true),
|
|
TextInput::make('password')->password()->required(fn ($livewire) => $livewire instanceof Pages\CreateUser)->dehydrateStateUsing(fn ($state) => filled($state) ? bcrypt($state) : null)->dehydrated(fn ($state) => filled($state)),
|
|
Select::make('roles')->multiple()->relationship('roles', 'name')->preload(),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table->columns([
|
|
TextColumn::make('id')->sortable(),
|
|
TextColumn::make('name')->searchable()->sortable(),
|
|
TextColumn::make('email')->searchable()->sortable(),
|
|
TextColumn::make('roles.name')->badge()->label('Roles'),
|
|
TextColumn::make('created_at')->dateTime()->sortable(),
|
|
])->actions([EditAction::make(), DeleteAction::make()]);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListUsers::route('/'),
|
|
'create' => Pages\CreateUser::route('/create'),
|
|
'edit' => Pages\EditUser::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|