Skip to content

Commit

Permalink
user resources created
Browse files Browse the repository at this point in the history
  • Loading branch information
Raza9798 committed Aug 28, 2024
1 parent d558eb2 commit 321da52
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
64 changes: 64 additions & 0 deletions app/Filament/App/Resources/UserResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace App\Filament\App\Resources;

use App\Filament\App\Resources\UserResource\Pages;
use App\Filament\App\Resources\UserResource\RelationManagers;
use App\Models\User;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class UserResource extends Resource
{
protected static ?string $model = User::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
//
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListUsers::route('/'),
'create' => Pages\CreateUser::route('/create'),
'edit' => Pages\EditUser::route('/{record}/edit'),
];
}
}
12 changes: 12 additions & 0 deletions app/Filament/App/Resources/UserResource/Pages/CreateUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Filament\App\Resources\UserResource\Pages;

use App\Filament\App\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;
}
19 changes: 19 additions & 0 deletions app/Filament/App/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Filament\App\Resources\UserResource\Pages;

use App\Filament\App\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}
19 changes: 19 additions & 0 deletions app/Filament/App/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Filament\App\Resources\UserResource\Pages;

use App\Filament\App\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListUsers extends ListRecords
{
protected static string $resource = UserResource::class;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

0 comments on commit 321da52

Please sign in to comment.