示例#1
0
 public function __construct(\App\Address $address)
 {
     $this->addressId = $address->id;
     $this->regionId = $address->region->id;
     $this->name = $address->region->name . " " . $address->name;
     if ($address->stars()->count() > 0) {
         foreach ($address->stars()->get() as $star) {
             $this->centers[] = new centerStar($star->id);
         }
     }
     if ($address->centers()->count() > 0) {
         foreach ($address->centers()->get() as $center) {
             $this->centers[] = new centerMulti($center->id);
         }
     }
 }