You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InvoiceResource.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Filament\Company\Resources\Sales;
  3. use App\Enums\Accounting\DocumentType;
  4. use App\Filament\Company\Resources\Accounting\DocumentResource;
  5. use App\Filament\Company\Resources\Sales\InvoiceResource\Pages;
  6. use App\Models\Accounting\Document;
  7. use Filament\Forms\Form;
  8. use Filament\Resources\Resource;
  9. use Filament\Tables\Table;
  10. use Illuminate\Database\Eloquent\Builder;
  11. class InvoiceResource extends Resource
  12. {
  13. protected static ?string $model = Document::class;
  14. protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
  15. protected static ?string $pluralModelLabel = 'Invoices';
  16. protected static ?string $modelLabel = 'Invoice';
  17. public static function getEloquentQuery(): Builder
  18. {
  19. return parent::getEloquentQuery()
  20. ->where('type', DocumentType::Invoice);
  21. }
  22. public static function form(Form $form): Form
  23. {
  24. return DocumentResource::form($form);
  25. }
  26. public static function table(Table $table): Table
  27. {
  28. return DocumentResource::table($table);
  29. }
  30. public static function getRelations(): array
  31. {
  32. return [
  33. //
  34. ];
  35. }
  36. public static function getPages(): array
  37. {
  38. return [
  39. 'index' => Pages\ListInvoices::route('/'),
  40. 'create' => Pages\CreateInvoice::route('/create'),
  41. 'edit' => Pages\EditInvoice::route('/{record}/edit'),
  42. ];
  43. }
  44. }