public function logoMenu() { $logo = TypeDocument::find(Auth::user()->account_id)->logo; return $logo; }
/** * Sets the value of fv_type_documents. * * @param mixed $fv_type_documents the fv_type_documents * * @return self */ public function setType_documents($fv_type_documents_branch) { if (!empty($fv_type_documents_branch)) { if (!is_array($fv_type_documents_branch)) { $this->fv_error_message = $this->fv_error_message . '<br>- Identificadores ' . ERROR_ARRAY; return $this->fv_type_documents_branch = null; } foreach ($fv_type_documents_branch as $type_document) { # code... if (Auth::check()) { $type_documentExiste = TypeDocument::find($type_document)->where('account_id', $this->account_id)->first(); } else { $type_documentExiste = TypeDocument::find($type_document)->where('account_id', $this->getAccount_id())->first(); } if (!$type_documentExiste) { $this->fv_error_message = $this->fv_error_message . '<br>- Identificador ' . ERROR_ID; return $this->fv_type_documents_branch = null; } } return $this->fv_type_documents_branch = $fv_type_documents_branch; } $this->fv_error_message = $this->fv_error_message . '<br>- Identificadores ' . ERROR_NULL; return $this->fv_type_documents_branch = null; }
public function Guardar() { if (!$this->id) { if (empty($this->fv_error_message)) { $this->account_id = $this->account_id ? $this->account->id : $this->fv_account_id; $this->name = $this->fv_name; $this->number_branch = $this->fv_number_branch; $this->address2 = $this->fv_address2; $this->address1 = $this->fv_address1; $this->work_phone = $this->fv_workphone; $this->city = $this->fv_city; $this->state = $this->fv_state; $this->deadline = $this->fv_deadline; $this->key_dosage = $this->fv_key_dossage; $this->economic_activity = $this->fv_economic_activity; $this->number_process = $this->fv_number_process; $this->number_autho = $this->fv_nummber_autho; $this->law = $this->fv_law; $this->type_third = $this->getType_thrird(); $this->invoice_number_counter = 1; $this->save(); $documento = TypeDocument::find(1); $tipo = new TypeDocumentBranch(); $tipo->branch_id = $this->id; $tipo->type_document_id = $documento->id; if ($this->type_third != 2) { $tipo->template = $documento->javascript_web; } else { $tipo->template = $documento->javascript_pos; } $tipo->save(); // foreach ($this->fv_type_documents_branch as $documento) { // # code... // $tipo = new TypeDocumentBranch(); // $tipo->branch_id = $this->id; // $tipo->type_document_id = $documento; // $tipo->save(); // } $this->fv_error_message = "Registro Existoso"; return true; } } $this->fv_error_message = $this->fv_error_message . ' Sucursal ' . ERROR_DUPLICADO . '<br>'; return false; }