Add Customer resource to Filament admin panel: Implemented Customer model, resource, and associated pages (create, edit, list). Defined customer form schema and table configuration. Added migration for customers table.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Customers;
|
||||
|
||||
use App\Filament\Admin\Resources\Customers\Pages\CreateCustomer;
|
||||
use App\Filament\Admin\Resources\Customers\Pages\EditCustomer;
|
||||
use App\Filament\Admin\Resources\Customers\Pages\ListCustomers;
|
||||
use App\Filament\Admin\Resources\Customers\Schemas\CustomerForm;
|
||||
use App\Filament\Admin\Resources\Customers\Tables\CustomersTable;
|
||||
use App\Models\Customer;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CustomerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Customer::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return CustomerForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return CustomersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListCustomers::route('/'),
|
||||
'create' => CreateCustomer::route('/create'),
|
||||
'edit' => EditCustomer::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user