Addresses now a collection
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
@@ -68,15 +69,19 @@ class Site extends Model
|
||||
/**
|
||||
* Return the site address as an array
|
||||
*
|
||||
* @return array
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAddressAttribute(): array
|
||||
public function getAddressAttribute(): Collection
|
||||
{
|
||||
return array_filter([
|
||||
$this->site_address1,
|
||||
$this->site_address2,
|
||||
sprintf('%s %s %s',$this->site_city.(($this->site_state OR $this->site_postcode) ? ',' : ''),$this->site_state,$this->site_postcode)
|
||||
]);
|
||||
return collect([
|
||||
'address1' => $this->site_address1,
|
||||
'address2' => $this->site_address2,
|
||||
'location' => sprintf('%s %s %s',
|
||||
$this->site_city.(($this->site_state || $this->site_postcode) ? ',' : ''),
|
||||
$this->site_state,
|
||||
$this->site_postcode)
|
||||
])
|
||||
->filter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user