How to combine multiple fields into one? Address field
Hi, my model has:
$table->string('name');
$table->string('email')->nullable()->unique();
$table->string('phone')->nullable();
$table->string('address')->nullable();
$table->integer('number')->nullable();
$table->string('city')->nullable();
$table->string('state')->nullable();
So, I need to have a searchable TextColumn with the field concatenated like:
4 Pennsylvania Plaza, New York, NY 10001, EE. UU.
I've tryed to create an attirbute
public function getFulladdressAttribute() : string {
return $this->address.' '.$this->number.' '.$this->city', '.$this->state;
}
but it's not found in the database.
Thanks
Solution:Jump to solution
virtual column is an option
https://filamentphp.com/docs/3.x/forms/fields/select#customizing-the-relationship-option-labels
```php
TextColumn::make('full_address')->searchable()...
4 Replies
I think this is what you are looking for
https://filamentphp.com/docs/3.x/tables/columns/getting-started#searching
Solution
I like this... let´s try
It's not the best solution, but it works ...
Filament needs to have the field in the database to search