Esempio n. 1
0
 /**
  *
  * Proses Simpan Bankaccount
  *
  * @return mixed
  */
 public function store()
 {
     if (!$this->hasAccess()) {
         return Response::json(array('success' => false, 'reason' => 'Action Need Login First', 'results' => null))->setCallback();
     }
     $this->bankaccount->name = Input::get('name');
     $this->bankaccount->number = Input::get('number');
     $this->bankaccount->owner_id = Input::get('owner_id');
     $ownertype = Input::get('owner_type');
     $ownertype = $ownertype == 'supplier' ? '\\Emayk\\Ics\\Repo\\Suppliers\\Suppliers' : '\\Emayk\\Ics\\Repo\\Buyers\\Buyers';
     $this->bankaccount->owner_type = $ownertype;
     $this->bankaccount->createby_id = $this->getUid();
     $this->bankaccount->created_at = Carbon::create();
     $this->bankaccount->currency_id = Input::get('currency_id');
     $this->bankaccount->tax_id = Input::get('tax_id');
     //        $this->bankaccount->type_id = Input::get('type_id');
     $this->bankaccount->bank_id = Input::get('bank_id');
     $this->bankaccount->uuid = uniqid('New_');
     $this->bankaccount->lastupdateby_id = $this->getUid();
     $this->bankaccount->updated_at = Carbon::create();
     $saved = $this->bankaccount->save() ? true : false;
     return Response::json(array('success' => $saved, 'results' => $this->bankaccount->toArray()))->setCallback();
 }