searchable() ->preload() ->createOptionForm(fn (Form $form) => $this->createVendorForm($form)) ->createOptionAction(fn (Action $action) => $this->createVendorAction($action)); $this->relationship('vendor', 'name'); $this->createOptionUsing(static function (array $data) { return DB::transaction(static function () use ($data) { $vendor = Vendor::createWithRelations($data); return $vendor->getKey(); }); }); } protected function createVendorForm(Form $form): Form { return VendorResource::form($form); } protected function createVendorAction(Action $action): Action { return $action ->label('Create vendor') ->slideOver() ->modalWidth(MaxWidth::ThreeExtraLarge) ->modalHeading('Create a new vendor'); } }