-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add filament Donor and Status resources
- Loading branch information
1 parent
c7ef23a
commit aa8575f
Showing
22 changed files
with
1,698 additions
and
1,015 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
php artisan make:filament-resource Donor/Status --generate | ||
php artisan db:seed | ||
php artisan make:filament-resource Donor/Donor --generate | ||
php artisan forms:install | ||
npm install && npm run dev | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor; | ||
|
||
use App\Filament\Resources\Donor\DonorResource\Pages; | ||
use App\Filament\Resources\Donor\DonorResource\RelationManagers; | ||
use App\Models\Donor\Donor; | ||
use Filament\Forms; | ||
use Filament\Resources\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Resources\Table; | ||
use Filament\Tables; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||
|
||
class DonorResource extends Resource | ||
{ | ||
protected static ?string $model = Donor::class; | ||
|
||
protected static ?string $navigationGroup = 'Donor'; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-collection'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\Select::make('status_id') | ||
->relationship('status', 'Status') | ||
->searchable() | ||
->required(), | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('email') | ||
->email() | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('full_address') | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('job_title') | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('social_type') | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('social_url') | ||
->maxLength(255), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('status_id'), | ||
Tables\Columns\TextColumn::make('name'), | ||
Tables\Columns\TextColumn::make('email'), | ||
Tables\Columns\TextColumn::make('full_address'), | ||
Tables\Columns\TextColumn::make('job_title'), | ||
Tables\Columns\TextColumn::make('social_type'), | ||
Tables\Columns\TextColumn::make('social_url'), | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime(), | ||
Tables\Columns\TextColumn::make('updated_at') | ||
->dateTime(), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
Tables\Actions\EditAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]); | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
// | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListDonors::route('/'), | ||
'create' => Pages\CreateDonor::route('/create'), | ||
'edit' => Pages\EditDonor::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Filament/Resources/Donor/DonorResource/Pages/CreateDonor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor\DonorResource\Pages; | ||
|
||
use App\Filament\Resources\Donor\DonorResource; | ||
use Filament\Pages\Actions; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateDonor extends CreateRecord | ||
{ | ||
protected static string $resource = DonorResource::class; | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Donor/DonorResource/Pages/EditDonor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor\DonorResource\Pages; | ||
|
||
use App\Filament\Resources\Donor\DonorResource; | ||
use Filament\Pages\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditDonor extends EditRecord | ||
{ | ||
protected static string $resource = DonorResource::class; | ||
|
||
protected function getActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Donor/DonorResource/Pages/ListDonors.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor\DonorResource\Pages; | ||
|
||
use App\Filament\Resources\Donor\DonorResource; | ||
use Filament\Pages\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListDonors extends ListRecords | ||
{ | ||
protected static string $resource = DonorResource::class; | ||
|
||
protected function getActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor; | ||
|
||
use App\Filament\Resources\Donor\StatusResource\Pages; | ||
use App\Filament\Resources\Donor\StatusResource\RelationManagers; | ||
use App\Models\Donor\Status; | ||
use Filament\Forms; | ||
use Filament\Resources\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Resources\Table; | ||
use Filament\Tables; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||
|
||
class StatusResource extends Resource | ||
{ | ||
protected static ?string $model = Status::class; | ||
|
||
protected static ?string $navigationLabel = 'Donor Statuses'; | ||
|
||
protected static ?string $navigationGroup = 'Donor'; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-collection'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->maxLength(255), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('name')->sortable(), | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime(), | ||
Tables\Columns\TextColumn::make('updated_at') | ||
->dateTime(), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
Tables\Actions\EditAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]); | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
// | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListStatuses::route('/'), | ||
'create' => Pages\CreateStatus::route('/create'), | ||
'edit' => Pages\EditStatus::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Filament/Resources/Donor/StatusResource/Pages/CreateStatus.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor\StatusResource\Pages; | ||
|
||
use App\Filament\Resources\Donor\StatusResource; | ||
use Filament\Pages\Actions; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateStatus extends CreateRecord | ||
{ | ||
protected static string $resource = StatusResource::class; | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Donor/StatusResource/Pages/EditStatus.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor\StatusResource\Pages; | ||
|
||
use App\Filament\Resources\Donor\StatusResource; | ||
use Filament\Pages\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditStatus extends EditRecord | ||
{ | ||
protected static string $resource = StatusResource::class; | ||
|
||
protected function getActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Donor/StatusResource/Pages/ListStatuses.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Donor\StatusResource\Pages; | ||
|
||
use App\Filament\Resources\Donor\StatusResource; | ||
use Filament\Pages\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListStatuses extends ListRecords | ||
{ | ||
protected static string $resource = StatusResource::class; | ||
|
||
protected function getActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.