How to store foreign key in import action?

I am trying to store the foreign key in a import action without success, but I don't know why. This should be possible right? This is the code
public function resolveRecord(): ?Client
{
return Client::firstOrNew([
'user_id' => Auth::user()->id,
'email' => $this->data['email'],
], [
'user_id' => Auth::user()->id,
'firstname' => $this->data['firstname'],
'lastname' => $this->data['lastname'],
]);
}
public function resolveRecord(): ?Client
{
return Client::firstOrNew([
'user_id' => Auth::user()->id,
'email' => $this->data['email'],
], [
'user_id' => Auth::user()->id,
'firstname' => $this->data['firstname'],
'lastname' => $this->data['lastname'],
]);
}
1 Reply
kekitek
kekitek4w ago
Is there no solution to this problem? I want to allow my users to import their clients, so I need to store the foreign key somehow.