Addresses now a collection
This commit is contained in:
parent
b63807fa82
commit
d96924bc65
@ -206,10 +206,9 @@ class Account extends Model implements IDs
|
|||||||
/**
|
/**
|
||||||
* Get the address for the account
|
* Get the address for the account
|
||||||
*
|
*
|
||||||
* @return array
|
* @return Collection
|
||||||
* @todo Change this to return a collection
|
|
||||||
*/
|
*/
|
||||||
public function getAddressAttribute(): array
|
public function getAddressAttribute(): Collection
|
||||||
{
|
{
|
||||||
return collect([
|
return collect([
|
||||||
'address1' => $this->address1,
|
'address1' => $this->address1,
|
||||||
@ -219,9 +218,7 @@ class Account extends Model implements IDs
|
|||||||
$this->state,
|
$this->state,
|
||||||
$this->zip)
|
$this->zip)
|
||||||
])
|
])
|
||||||
->filter()
|
->filter();
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,15 +69,19 @@ class Site extends Model
|
|||||||
/**
|
/**
|
||||||
* Return the site address as an array
|
* Return the site address as an array
|
||||||
*
|
*
|
||||||
* @return array
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getAddressAttribute(): array
|
public function getAddressAttribute(): Collection
|
||||||
{
|
{
|
||||||
return array_filter([
|
return collect([
|
||||||
$this->site_address1,
|
'address1' => $this->site_address1,
|
||||||
$this->site_address2,
|
'address2' => $this->site_address2,
|
||||||
sprintf('%s %s %s',$this->site_city.(($this->site_state OR $this->site_postcode) ? ',' : ''),$this->site_state,$this->site_postcode)
|
'location' => sprintf('%s %s %s',
|
||||||
]);
|
$this->site_city.(($this->site_state || $this->site_postcode) ? ',' : ''),
|
||||||
|
$this->site_state,
|
||||||
|
$this->site_postcode)
|
||||||
|
])
|
||||||
|
->filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,22 +34,20 @@
|
|||||||
<!-- info row -->
|
<!-- info row -->
|
||||||
<div class="row invoice-info">
|
<div class="row invoice-info">
|
||||||
<div class="col-4 invoice-col">
|
<div class="col-4 invoice-col">
|
||||||
FROM:
|
|
||||||
<address>
|
<address>
|
||||||
<strong>{{ $site->site_name }}</strong><br>
|
FROM: <strong>{{ $site->site_name }}</strong><br>
|
||||||
{!! join('<br>',$site->address) !!}
|
{!! $site->address->join('<br>') !!}
|
||||||
<br>
|
<br><br>
|
||||||
<strong>Email:</strong> {{ $site->site_email }}<br>
|
<strong>Email:</strong> {{ $site->site_email }}<br>
|
||||||
<strong>Phone:</strong> {{ $site->site_phone }}
|
<strong>Phone:</strong> {{ $site->site_phone }}
|
||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-4 invoice-col">
|
<div class="col-4 invoice-col">
|
||||||
TO:
|
|
||||||
<address>
|
<address>
|
||||||
<strong>{{ $o->account->company }}</strong><br>
|
TO: <strong>{{ $o->account->company }}</strong><br>
|
||||||
{!! join('<br>',$o->account->address) !!}
|
{!! $o->account->address->join('<br>') !!}
|
||||||
<br>
|
<br><br>
|
||||||
<strong>Email:</strong> {{ $o->account->user->email }}<br>
|
<strong>Email:</strong> {{ $o->account->user->email }}<br>
|
||||||
@if ($o->account->phone)
|
@if ($o->account->phone)
|
||||||
<strong>Phone:</strong> {{ $o->account->phone }}<br>
|
<strong>Phone:</strong> {{ $o->account->phone }}<br>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
@component('mail::footer')
|
@component('mail::footer')
|
||||||
<div class="fixedw" style="text-align: right; font-size: 0.8em;">
|
<div class="fixedw" style="text-align: right; font-size: 0.8em;">
|
||||||
{{ config('mail.from.name') }}<br>
|
{{ config('mail.from.name') }}<br>
|
||||||
{!! join('<br>',$site->address) !!}<br>
|
{!! $site->address->join('<br>') !!}<br>
|
||||||
{{ $site->site_email }}
|
{{ $site->site_email }}
|
||||||
</div>
|
</div>
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<h2 style="text-align: right;">Our Contact Details</h2>
|
<h2 style="text-align: right;">Our Contact Details</h2>
|
||||||
<address class="margin-bottom-40" style="float: right;">
|
<address class="margin-bottom-40" style="float: right;">
|
||||||
<table>
|
<table>
|
||||||
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! join('<br>',$site->address) !!}</td></tr>
|
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! $site->address->join('<br>') !!}</td></tr>
|
||||||
@isset($site->site_fax)
|
@isset($site->site_fax)
|
||||||
<tr><th>Fax</th><td>{{ $site->site_fax }}</tr>
|
<tr><th>Fax</th><td>{{ $site->site_fax }}</tr>
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
Reference in New Issue
Block a user