-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(customer-data): add Filament resource and navigation for Custome…
…r Data - Implemented `CustomerDataResource` for managing customer data via Filament. - Added navigation item under 'Société' group with direct link to a customer record. - Replaced `dd` with `abort(404)` for better error handling in the route.
- Loading branch information
frederic moras
committed
Dec 31, 2024
1 parent
e2d1ce0
commit cce7f9c
Showing
2 changed files
with
71 additions
and
1 deletion.
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,60 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\CustomerDataResource\Pages\ViewCustomerData; | ||
use App\Models\CustomerData; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
|
||
|
||
class CustomerDataResource extends Resource | ||
{ | ||
protected static ?string $model = CustomerData::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-user'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('address') | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('email') | ||
->email() | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('phone') | ||
->tel() | ||
->maxLength(255), | ||
Forms\Components\Textarea::make('notes'), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'view' => ViewCustomerData::route('/{record}'), | ||
]; | ||
} | ||
|
||
public static function getGloballySearchableAttributes(): array | ||
{ | ||
return ['email', 'name']; | ||
} | ||
|
||
public static function getNavigationLabel(): string | ||
{ | ||
return 'Customer Data'; | ||
} | ||
|
||
public static function shouldRegisterNavigation(): bool | ||
{ | ||
return false; | ||
} | ||
} |
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