/** * @return array */ public function toArray() { $response = $this->developer->toArray(); $response['amount'] = $this->amount(); $response['total_price'] = $this->totalPrice(); return $response; }
public function get($login = '') { if (empty($login)) { $this->search(); } else { $this->renderJSON(\Beeblebrox3\DevShop\Repositories\Developer::whereLogin($login)->first()->toArray()); } }
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(); }
public function clean() { Organization::truncate(); Developer::truncate(); }