12345678910111213141516171819202122 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class CompanyLocation extends Model
- {
- protected $table = 'company_location';
- public function displayName(){
- $parts = [$this->internal_name, $this->line1, $this->city, $this->state];
- if(trim(implode('', $parts)) == '') return '';
- return implode(", ", $parts);
- }
- public function format(){
- return $this->line1.($this->line2? ', '.$this->line2: '').($this->city?', '.$this->city:'').($this->state?', '.$this->state:'').($this->zip? ' '.$this->zip:'');
- }
- }
|