本文整理汇总了PHP中Branch::createNew方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::createNew方法的具体用法?PHP Branch::createNew怎么用?PHP Branch::createNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::createNew方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
private function save($branchPublicId = false)
{
if ($branchPublicId) {
$branch = Branch::scope($branchPublicId)->firstOrFail();
} else {
$branch = Branch::createNew();
}
$branch->name = trim(Input::get('name'));
$branch->address1 = trim(Input::get('address1'));
$branch->address2 = trim(Input::get('address2'));
$branch->city = trim(Input::get('city'));
$branch->state = trim(Input::get('state'));
$branch->postal_code = trim(Input::get('postal_code'));
$branch->country_id = Input::get('country_id') ? Input::get('country_id') : null;
$branch->industry_id = Input::get('industry_id') ? Input::get('industry_id') : null;
$branch->number_autho = Input::get('number_autho');
$branch->deadline = date("Y-m-d", strtotime(Input::get('deadline')));
$branch->key_dosage = Input::get('key_dosage');
$branch->activity_pri = Input::get('activity_pri');
$branch->activity_sec1 = Input::get('activity_sec1');
$branch->law = Input::get('law');
$branch->save();
$message = $branchPublicId ? trans('texts.updated_branch') : trans('texts.created_branch');
Session::flash('message', $message);
return Redirect::to('company/branches');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
if (Auth::user()->is_admin) {
$branch = Branch::createNew();
// $branch->setAccountId(Session::get('account_id'));
$branch->setType_documents(Input::get('tipo_documento'));
$branch->setName(Input::get('branch_name'));
$branch->setNumber_branch(Input::get('number_branch'));
$branch->setAddress1(Input::get('address1'));
$branch->setAddress2(Input::get('address2'));
$branch->setWorkphone(Input::get('work_phone'));
$branch->setCity(Input::get('city'));
$branch->setState(Input::get('state'));
$dateparser = explode("/", Input::get('deadline'));
$date = $dateparser[2] . '-' . $dateparser[1] . '-' . $dateparser[0];
$branch->setDeadline($date);
$branch->setKey_dosage(Input::get('key_dosage'));
$branch->setEconomic_activity(Input::get('economic_activity'));
$branch->setNumber_process(Input::get('number_process'));
$branch->setNumber_autho(Input::get('number_autho'));
$branch->setLaw(Input::get('law'));
$branch->setType_thrird(Input::get('third_view'));
$branch->sfc = Input::get('sfc');
// return var_dump($branch);
if ($branch->Guardar()) {
Session::flash('message', $branch->getErrorMessage());
return Redirect::to('sucursales');
}
Session::flash('error', $branch->getErrorMessage());
return Redirect::to('sucursales/create');
}
return Redirect::to('/inicio');
}
示例3: postpaso2
public function postpaso2()
{
if (Session::has('account_id')) {
// return Response::json(Input::all());
$branch = Branch::createNew();
$branch->setAccountId(Session::get('account_id'));
$branch->setType_documents(Input::get('tipo_documento'));
$branch->setName(Input::get('branch_name'));
$branch->setNumber_branch(Input::get('number_branch'));
$branch->setAddress1(Input::get('address1'));
$branch->setAddress2(Input::get('address2'));
$branch->setWorkphone(Input::get('work_phone'));
$branch->setCity(Input::get('city'));
$branch->setState(Input::get('state'));
$branch->setDeadline(Input::get('deadline'));
$branch->setKey_dosage(Input::get('key_dosage'));
$branch->setEconomic_activity(Input::get('economic_activity'));
$branch->setNumber_process(Input::get('number_process'));
$branch->setNumber_autho(Input::get('number_autho'));
$branch->setLaw(Input::get('law'));
$branch->setType_thrird(Input::get('third_view'));
$branch->sfc = Input::get('sfc');
// return var_dump($branch);
if ($branch->Guardar()) {
if (Input::has('is_uniper')) {
//
$account = Account::find($branch->account_id);
$account->is_uniper = Input::get("is_uniper");
$account->uniper = Input::get("uniper");
$account->op2 = true;
$account->save();
}
Session::flash('message', $branch->getErrorMessage());
return Redirect::to('paso/3');
}
Session::flash('error', $branch->getErrorMessage());
return Redirect::to('paso/2');
}
return Redirect::to('/');
}
示例4: save
private function save($branchPublicId = false)
{
// $error = false;
// $var1 = 'NÚMERO DE TRAMITE';
// $var2 = 'NÚMERO DE AUTORIZACIÓN';
// $number_tramit = trim(Input::get('number_process'));
// $number_autho = trim(Input::get('number_autho'));
// if(Input::file('dosage'))
// {
// $file = Input::file('dosage');
// $name = $file->getRealPath();
// $i = 0;
// $file = fopen($name, "r");
// while(!feof($file))
// {
// $process1 = fgets($file);
// if($i =='0')
// {
// $process2 = explode(":", $process1);
// $result1 = $process2[0];
// if(strcmp($result1, $var1) !== 0){$error=1;}
// $result1 = trim($process2[1]);
// if(strcmp($result1, $number_tramit) !== 0){$error=1;}
// }
// if($i =='2')
// {
// $process2 = explode(":", $process1);
// $result2 = $process2[0];
// if(strcmp($result2, $var2) !== 0){$error=1;}
// $result1 = trim($process2[1]);
// if(strcmp($result1, $number_autho) !== 0){$error=1;}
// }
// $i++;
// }
// fclose($file);
// }
// if ($error ==1)
// {
// Session::flash('error', 'Arhivo inválido');
// $url = $branchPublicId ? 'branches/' . $branchPublicId . '/edit' : 'branches/create';
// return Redirect::to('company/branches');
// }
// else
// {
if ($branchPublicId) {
$branch = Branch::scope($branchPublicId)->firstOrFail();
} else {
$branch = Branch::createNew();
}
$branch->name = trim(Input::get('branch_name'));
$branch->branch_type_id = trim(Input::get('branch_type_id'));
$branch->address2 = trim(Input::get('address2'));
$branch->address1 = trim(Input::get('address1'));
$branch->work_phone = trim(Input::get('work_phone'));
$branch->city = trim(Input::get('city'));
$branch->state = trim(Input::get('state'));
$branch->deadline = Input::get('deadline');
$branch->key_dosage = trim(Input::get('dosage'));
// if(Input::file('dosage'))
// {
// $file = Input::file('dosage');
// $name = $file->getRealPath();
// $i = 0;
// $file = fopen($name, "r");
// while(!feof($file))
// {
// $process1 = fgets($file);
// if($i =='0')
// {
// $process2 = explode(":", $process1);
// $result1 = $process2[1];
// }
// if($i =='2')
// {
// $process2 = explode(":", $process1);
// $result2 = $process2[1];
// }
// if($i =='6')
// {
// $result3 = $process1;
// }
// $i++;
// }
// fclose($file);
// $branch->number_process = trim($result1);
// $branch->number_autho = trim($result2);
// $branch->key_dosage = trim($result3);
// }
$branch->economic_activity = trim(Input::get('economic_activity'));
$branch->number_process = trim(Input::get('number_process'));
$branch->number_autho = trim(Input::get('number_autho'));
$branch->key_dosage = trim(Input::get('key_dosage'));
$branch->law = trim(Input::get('law'));
$branch->type_third = trim(Input::get('third_view'));
$branch->invoice_number_counter = 1;
$branch->save();
$account = Auth::user()->account;
$account->op2 = true;
$account->save();
$message = $branchPublicId ? trans('texts.updated_branch') : trans('texts.created_branch');
//.........这里部分代码省略.........