当前位置: 首页>>代码示例>>PHP>>正文


PHP Branch::findOrFail方法代码示例

本文整理汇总了PHP中Branch::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::findOrFail方法的具体用法?PHP Branch::findOrFail怎么用?PHP Branch::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Branch的用法示例。


在下文中一共展示了Branch::findOrFail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * Update the specified branch in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $branch = Branch::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Branch::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $branch->update($data);
     return Redirect::route('branches.index');
 }
开发者ID:bryanestrito,项目名称:datawarehouse_etl,代码行数:16,代码来源:BranchesController.php

示例2: postDesv

 /**
  * Show the form for creating a new resource.
  * @param Request $request
  * @return Response
  */
 public function postDesv(Request $request)
 {
     $ids = $request->get('people');
     if ($ids != null) {
         $branch = Branch::findOrFail($request->get('branch'));
         $branch->people()->detach($ids);
         for ($i = 0; $i < count($ids); $i++) {
             $user = People::find($ids[$i])->user;
             $user->roles()->detach();
         }
         flash()->success('Se han desviculado (' . count($ids) . ') personas de la sucursal ' . $branch->name);
     } else {
         $branch = Branch::findOrFail($request->get('branch'));
         flash()->overlay('No se encontraron personas para desvincular de la sucursal ' . $branch->name . '.', 'Notificacion de errores');
     }
     return view('admin.showpeople', compact('branch'));
 }
开发者ID:EstebanJesus,项目名称:bancopedagogico-v2,代码行数:22,代码来源:PeopleTraits.php

示例3: update

 /**
  * Update the specified journal in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $journal = Journal::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Journal::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $branch = Branch::findOrFail(Input::get('branch_id'));
     $account = Account::findOrFail(Input::get('account_id'));
     $journal->branch()->associate($branch);
     $journal->account()->associate($account);
     $journal->date = Input::get('date');
     $journal->trans_no = Input::get('trans_no');
     $journal->initiated_by = Input::get('initiated_by');
     $journal->amount = Input::get('amount');
     $journal->type = Input::get('type');
     $journal->description = Input::get('description');
     $journal->update();
     return Redirect::route('journals.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:26,代码来源:JournalsController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $branch = \Input::get('branch_id');
     $contact = \Input::get('contact_id');
     if ($branch) {
         $updateBranch = \Branch::findOrFail($branch);
         $updateBranch->branch_name = \Input::get('branch_name');
         $updateBranch->branch_code = \Input::get('branch_code');
         $updateBranch->branch_address = \Input::get('branch_address');
         $updateBranch->branch_city = \Input::get('branch_city');
         $updateBranch->branch_state = \Input::get('branch_state');
         $updateBranch->branch_pin = \Input::get('branch_pin');
         $updateBranch->branch_land_line = \Input::get('branch_land_line');
         $updateBranch->branch_alt_land_line = \Input::get('branch_alt_land_line');
         $updateBranch->branch_fax = \Input::get('branch_fax');
         if ($updateBranch->save()) {
             echo "Branch information successfully updated";
             return;
         } else {
             echo "Failed to update";
             return;
         }
     }
     if ($contact) {
         $updateContact = \BranchContact::findOrFail($contact);
         $updateContact->branch_head = \Input::get('branch_head');
         $updateContact->p_mobile_no = \Input::get('p_mobile_no');
         $updateContact->p_alt_mobile_no = \Input::get('p_alt_mobile_no');
         $updateContact->p_email = \Input::get('p_email');
         $updateContact->p_alt_email = \Input::get('p_alt_email');
         $updateContact->s_contact_person = \Input::get('s_contact_person');
         $updateContact->s_mobile_no = \Input::get('s_mobile_no');
         $updateContact->s_alt_mobile_no = \Input::get('s_alt_mobile_no');
         $updateContact->s_email = \Input::get('s_email');
         $updateContact->s_alt_email = \Input::get('s_alt_email');
         if ($updateContact->save()) {
             echo " Contact Successfully updated";
             return;
         } else {
             echo "Failed to update";
             return;
         }
     }
 }
开发者ID:bhoopal10,项目名称:PayrollOriginal,代码行数:50,代码来源:BranchController.php

示例5: update

 /**
  * Update the specified member in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $member = Member::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Member::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::get('branch_id') != null) {
         $branch = Branch::findOrFail(Input::get('branch_id'));
         $member->branch()->associate($branch);
     }
     if (Input::get('group_id') != null) {
         $group = Group::findOrFail(Input::get('group_id'));
         $member->group()->associate($group);
     }
     //$member->photo = Input::get('photo');
     //$member->signature = Input::get('signature');
     if (Input::hasFile('photo')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('photo')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('photo')->move($destination, $photo);
         $member->photo = $photo;
     }
     if (Input::hasFile('signature')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('signature')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('signature')->move($destination, $photo);
         $member->signature = $photo;
     }
     $member->name = Input::get('name');
     $member->id_number = Input::get('id_number');
     $member->membership_no = Input::get('membership_no');
     $member->phone = Input::get('phone');
     $member->email = Input::get('email');
     $member->address = Input::get('address');
     $member->monthly_remittance_amount = Input::get('monthly_remittance_amount');
     $member->gender = Input::get('gender');
     $member->update();
     return Redirect::route('members.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:50,代码来源:MembersController.php


注:本文中的Branch::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。