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
4 Replies
Solution
LeandroFerreira
LeandroFerreira3mo ago
virtual column is an option https://filamentphp.com/docs/3.x/forms/fields/select#customizing-the-relationship-option-labels
TextColumn::make('full_address')->searchable()
TextColumn::make('full_address')->searchable()
PabloZagni
PabloZagni3mo ago
I like this... let´s try
PabloZagni
PabloZagni3mo ago
It's not the best solution, but it works ... Filament needs to have the field in the database to search
Want results from more Discord servers?
Add your server
More Posts