CompanyLocation.php 579 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class CompanyLocation extends Model
  5. {
  6. protected $table = 'company_location';
  7. public function displayName(){
  8. $parts = [$this->internal_name, $this->line1, $this->city, $this->state];
  9. if(trim(implode('', $parts)) == '') return '';
  10. return implode(", ", $parts);
  11. }
  12. public function format(){
  13. return $this->line1.($this->line2? ', '.$this->line2: '').($this->city?', '.$this->city:'').($this->state?', '.$this->state:'').($this->zip? ' '.$this->zip:'');
  14. }
  15. }