示例#1
0
 /**
  * @return array
  */
 public function toArray()
 {
     $response = $this->developer->toArray();
     $response['amount'] = $this->amount();
     $response['total_price'] = $this->totalPrice();
     return $response;
 }
示例#2
0
 public function get($login = '')
 {
     if (empty($login)) {
         $this->search();
     } else {
         $this->renderJSON(\Beeblebrox3\DevShop\Repositories\Developer::whereLogin($login)->first()->toArray());
     }
 }
示例#3
0
 public function post()
 {
     $inputItems = $this->getHttp()->getInput('items', array());
     $items = array();
     foreach ($inputItems as $item) {
         if (!empty($item['login'])) {
             $items[(string) $item['login']] = (int) isset($item['amount']) ? $item['amount'] : 0;
         }
     }
     $developers = \Beeblebrox3\DevShop\Repositories\Developer::whereIn('login', array_keys($items))->get();
     foreach ($developers as $developer) {
         $this->Cart->addDev($developer, $items[$developer->login]);
     }
     $this->get();
 }
示例#4
0
 public function clean()
 {
     Organization::truncate();
     Developer::truncate();
 }