Reputation: 555
My User
model has a nullable column name
. I never want to import users, that have no name.
I tried
public function toSearchableArray()
{
if (!$this->name) {
return [
'name' => $this->name,
'email' => $this->email,
];
}
}
but this has no effect to the import or adding.
Upvotes: 0
Views: 54
Reputation: 2315
This function help to determine if the model should be searchable.
public function shouldBeSearchable(): bool
{
return (bool) $this->name;
}
Upvotes: 0