20 lines
515 B
PHP
20 lines
515 B
PHP
<?php
|
|
|
|
namespace App\Models\Objects\Values;
|
|
|
|
class TextValue extends Value {
|
|
protected $table = 'field_text_values';
|
|
|
|
public function get() {
|
|
return $this->value ? trim($this->value) : null;
|
|
}
|
|
public function set($value): bool {
|
|
return parent::set(trim($value));
|
|
}
|
|
|
|
public static function applyFilter($query, $value) {
|
|
collect(explode(' ', trim($value)))->each(function($term) use($query) {
|
|
$query->where('value', 'like', "%{$term}%");
|
|
});
|
|
}
|
|
} |