mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-09-06 13:35:34 +01:00
Ensure that empty values do not add to or from conditions
This commit is contained in:
parent
634fc87897
commit
9f1d80f968
2 changed files with 31 additions and 6 deletions
|
@ -48,9 +48,11 @@ class Filter
|
|||
*/
|
||||
public function from($values)
|
||||
{
|
||||
$this->properties['from'] = collect($values)->map(function ($value) {
|
||||
return trim($value);
|
||||
})->all();
|
||||
if (!empty($values)) {
|
||||
$this->properties['from'] = collect($values)->map(function ($value) {
|
||||
return trim($value);
|
||||
})->all();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -62,9 +64,11 @@ class Filter
|
|||
*/
|
||||
public function to($values)
|
||||
{
|
||||
$this->properties['to'] = collect($values)->map(function ($value) {
|
||||
return trim($value);
|
||||
})->all();
|
||||
if (!empty($values)) {
|
||||
$this->properties['to'] = collect($values)->map(function ($value) {
|
||||
return trim($value);
|
||||
})->all();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue