CreateOptionUsing Exception

My code look as follow also when createOptionUsing is executed everything works pefectly but when I return the newly created id of my tags, it throw this exception (screenshot)

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('tag_id')
                    ->label('')
                    ->multiple()
                    ->options(function (callable $get) {
                        return $this->team->tags()->pluck('name', 'id');
                    })
                    ->model(Team::class)
                    ->relationship('tags', 'name')
                    ->createOptionForm([
                            TextInput::make('name')
                                ->required(),
                            ColorPicker::make('color')
                                ->hex()
                                ->default('#000000')
                    ])
                    ->createOptionUsing(function (array $data): int {
                        return auth()->user()->currentTeam->tags()->create($data)->getKey();
                    })
                    ->searchable()
            ]);
    }


Thanks
image.png
Was this page helpful?