public function addAction()
 {
     $producers = new PhonesProducers();
     $producers->name = $this->request->getPost('name');
     $producers->save();
     $this->flash->success("New producer was added.");
     $this->dispatcher->forward(['action' => 'index']);
 }
Example #2
0
 public function addAction()
 {
     $phones = new Phones();
     $producer = PhonesProducers::findFirst("name = '" . $this->request->getPost('producer') . "'");
     $producerId = $producer->id;
     $phones->producer_id = $producerId;
     $OS = OperatingSystems::findFirst("name = '" . $this->request->getPost('OS') . "'");
     $OSId = $OS->id;
     $phones->operating_system_id = $OSId;
     $phones->model = $this->request->getPost('model');
     $phones->save();
     $this->flash->success("Phone was successfully added.");
     $this->dispatcher->forward(['action' => 'index']);
 }