Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column not found: 1054 Unknown column 'user_id' in 'field list' #100

Open
SidneySaints opened this issue Nov 1, 2022 · 1 comment
Open

Comments

@SidneySaints
Copy link

SidneySaints commented Nov 1, 2022

Hi,

if you customize users foreign key in the config, create method throws an exception user_id column can not be found.

something like this do the trick:

 return $this->generate()->map(fn(string $code) => app(PromocodeContract::class)->create([
            config('promocodes.models.users.foreign_id') => optional($this->user)->id,
            'code' => $code,
            'usages_left' => $this->unlimited ? -1 : $this->usagesLeft,
            'bound_to_user' => $this->user || $this->boundToUser,
            'multi_use' => $this->multiUse,
            'details' => $this->details,
            'expired_at' => $this->expiredAt,
        ]));
@ArtMin96
Copy link

ArtMin96 commented Oct 3, 2023

Have same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants