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


PHP Branch::findOrFail方法代码示例

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


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

示例1: showWaitingRoom

 public function showWaitingRoom(Request $request)
 {
     if ($request->session()->get('global_branch') == 'all') {
         $branches = Branch::all();
     } else {
         $branches[] = Branch::findOrFail($request->session()->get('global_branch'));
     }
     $vars = array('branches' => $branches);
     return view('backend.page.waiting-room')->with($vars);
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:10,代码来源:WaitingRoomController.php

示例2: doAddStockItem

 public function doAddStockItem(Request $request)
 {
     if (count($request->input('branches')) > 0) {
         $stock_item = Stock::addNew(["name" => $request->input('name'), "ean" => $request->input('ean'), "low_stock_notification_level" => $request->input('low-stock-number')]);
         foreach ($request->input('branches') as $branch_id) {
             $branch = Branch::findOrFail($branch_id);
             $stock_item->attachToBranch($branch);
         }
     }
     return redirect()->back()->with('stock-item-added', true);
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:11,代码来源:StockController.php

示例3: getWaitingRoomCount

 public static function getWaitingRoomCount()
 {
     if (session('global_branch') == 'all') {
         $branches = Branch::all();
     } else {
         $branches[] = Branch::findOrFail(session('global_branch'));
     }
     $waiting_room_total = 0;
     foreach ($branches as $b) {
         $waiting_room_total += $b->appointments()->where('status_id', 3)->count();
     }
     return $waiting_room_total;
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:13,代码来源:Appointment.php

示例4: showWaitingRoom

 public function showWaitingRoom(Request $request)
 {
     if ($request->session()->get('global_branch') == 'all') {
         $branches = Branch::all();
     } else {
         $branches[] = Branch::findOrFail($request->session()->get('global_branch'));
     }
     view()->share('branches', $branches);
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:9,代码来源:Controller.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (Auth::user()->role === 'superadmin') {
         $data = Branch::findOrFail($id);
         $data->delete();
         return redirect('branch');
     } else {
         return redirect('auth/login');
     }
 }
开发者ID:nazmule27,项目名称:pos,代码行数:16,代码来源:BranchController.php

示例6: doRemoveStaffFromBranch

 public function doRemoveStaffFromBranch($staff_id, $branch_id)
 {
     $branch = Branch::findOrFail($branch_id);
     $branch->staff()->detach($staff_id);
     return back()->with('staff-detached', true);
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:6,代码来源:BranchController.php

示例7: postAddroleindex

 /**
  * @param AddRoleRequest $request
  * @return \Illuminate\View\View
  */
 public function postAddroleindex(AddRoleRequest $request)
 {
     $branch = Branch::findOrFail($request->get('branch_id'));
     $people = People::where('document', $request->get('document'))->get();
     if (!$branch->worker->isEmpty()) {
         $worker = $branch->worker;
         $int = 0;
         foreach ($worker as $w) {
             if ($w->people_id == $people[0]->id) {
                 $int++;
             }
         }
         if ($int != 0) {
             flash()->overlay('No se pudo realizar la operación debido a que ya está registrada la persona ' . $people[0]->names . ' como empleado de esta sucursal.', 'Notificación de errores');
             $people = People::all();
             return redirect(url('/admin/role'));
         } else {
             $branch->worker()->save(new Worker(['people_id' => $people[0]->id]));
             $user = $people[0]->user;
             $user->roles()->sync($request->get('role_ids'));
             flash()->success('Se realizó la asignación de roles con éxito.');
             return redirect(url('/admin/role'));
         }
     } else {
         $branch->worker()->save(new Worker(['people_id' => $people[0]->id]));
         $user = $people[0]->user;
         $user->roles()->sync($request->get('role_ids'));
         flash()->success('Se realizó la asignación de roles con éxito.');
         return redirect(url('/admin/role'));
     }
 }
开发者ID:EstebanJesus,项目名称:bancopedagogico,代码行数:35,代码来源:AdminController.php


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