當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。