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.

CreateOffering.php 795B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Filament\Company\Resources\Common\OfferingResource\Pages;
  3. use App\Concerns\RedirectToListPage;
  4. use App\Filament\Company\Resources\Common\OfferingResource;
  5. use Filament\Resources\Pages\CreateRecord;
  6. use Illuminate\Database\Eloquent\Model;
  7. class CreateOffering extends CreateRecord
  8. {
  9. use RedirectToListPage;
  10. protected static string $resource = OfferingResource::class;
  11. protected function handleRecordCreation(array $data): Model
  12. {
  13. $attributes = array_flip($data['attributes'] ?? []);
  14. $data['sellable'] = isset($attributes['Sellable']);
  15. $data['purchasable'] = isset($attributes['Purchasable']);
  16. unset($data['attributes']);
  17. return parent::handleRecordCreation($data); // TODO: Change the autogenerated stub
  18. }
  19. }