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


PHP Branch::all方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (Auth::user()->role === 'superadmin' && Auth::user()->email === 'nlnazmul@gmail.com') {
         $all_data = Branch::all();
         return view('branch.home', compact('all_data'));
     } else {
         return redirect('auth/login');
     }
 }
开发者ID:nazmule27,项目名称:pos,代码行数:14,代码来源:BranchController.php

示例2: 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

示例3: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $party = $this->party->orderBy('name', 'asc')->lists('name', 'id');
     if (Auth::user()->hasRole('admin')) {
         $branch = Branch::all()->lists('name', 'id');
     } else {
         $branch = $this->branch->orderBy('name', 'asc')->lists('name', 'id');
     }
     return view('godown.create', compact('party', 'branch'));
 }
开发者ID:sahilbhatt92,项目名称:transpt,代码行数:15,代码来源:GodownController.php

示例4: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Define first day of current month.
     $date = date('Y-m') . '-01';
     // Get all the branches.
     $branches = Branch::all();
     foreach ($branches as $branch) {
         // Try to get expense.
         $expense = Expense::where('BranchId', '=', $branch->Id)->where('Date', '=', $date)->first();
         if (!$expense) {
             $default = json_decode($branch->DefaultExpenses);
             if ($default->regimen == 'cuotafija') {
                 Expense::create(array('Date' => $date, 'BranchId' => $branch->Id, 'Electricity' => $default->electricity, 'Water' => $default->water, 'Telecommunications' => $default->phone, 'Rent' => $default->rent, 'Depreciation' => $default->depreciation, 'Security' => $default->security, 'Government' => $default->government, 'Taxes' => $default->taxes, 'Regimen' => $default->regimen, 'TaxesSettled' => 1));
             } else {
                 Expense::create(array('Date' => $date, 'BranchId' => $branch->Id, 'Electricity' => $default->electricity, 'Water' => $default->water, 'Telecommunications' => $default->phone, 'Rent' => $default->rent, 'Depreciation' => $default->depreciation, 'Security' => $default->security, 'Government' => $default->government, 'Taxes' => $default->taxes, 'Regimen' => $default->regimen, 'TaxesSettled' => 0));
             }
         }
     }
 }
开发者ID:patrickdamery,项目名称:Eirene,代码行数:24,代码来源:LoadExpenses.php

示例5: 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

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $branches = Branch::all();
     $returnData = array('status' => 'ok', 'branches' => $branches, 'code' => 200);
     return $returnData;
 }
开发者ID:premsingh4github,项目名称:edealer,代码行数:11,代码来源:BranchController.php

示例7: getAllBranches

 public function getAllBranches($table)
 {
     $branches = Branch::all();
     $tables_ids = [];
     $guests = [];
     $branches_ids = [];
     foreach ($branches as $branche) {
         if ($branche->position_id == 2) {
             $branches_ids[] = $branche->id;
         }
     }
     $tables = \DB::table('tables')->whereIn('branche_id', $branches_ids)->get();
     foreach ($tables as $tbl) {
         $tables_ids[] = $tbl->id;
     }
     $currentGuest = Que::whereIn('table_id', $tables_ids)->orderBy('the_time')->get();
     foreach ($currentGuest as $guest) {
         $guests[] = $guest->guest_id;
     }
     $items = Guest::whereIn('id', $guests)->where('status', '!=', 'token')->get();
     return view('distribution.distribution')->with(['items' => $items, 'branches' => $branches, 'branche' => Table::find($table)->branche_id, 'table' => $table]);
 }
开发者ID:Avimunk,项目名称:Que,代码行数:22,代码来源:GuestsController1.php

示例8: 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

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $jobs = Job::all();
     return View("invoicing.index", ['branches' => Branch::all(), 'companies' => Company::all(), 'jobs' => $jobs, 'title' => 'Invoicing Console']);
 }
开发者ID:runningjack,项目名称:lexmark2,代码行数:11,代码来源:InvoicingController.php

示例10: showBranches

 public function showBranches()
 {
     $branches = Branch::all();
     $vars = array("branches" => $branches);
     return view('backend.page.branch-list')->with($vars);
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:6,代码来源:BranchController.php

示例11: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Get providers.
     $providers = Provider::all();
     // Get the branches.
     $branches = Branch::all();
     // Loop through them and check which ones are set to auto order.
     foreach ($providers as $provider) {
         if ($provider->AIManaged) {
             foreach ($branches as $branch) {
                 // Now let's get all the products for this provider.
                 $products = Stock::where('BranchId', '=', $branch->Id)->where('ProviderId', '=', $provider->Id)->get();
                 $order = array();
                 foreach ($products as $product) {
                     if ($product->Quantity <= $product->Minimum) {
                         $order[$product->Code] = array('Code' => $product->Code, 'Description' => $product->Description, 'Exist' => $product->Quantity, 'Cost' => $product->Cost, 'Minimum' => $product->Minimum, 'Order' => 0, 'Average' => 0, 'Sold' => 0);
                     }
                 }
                 // Get all the products sold in selected sample range.
                 $today = date('Y-m-d H:i:s');
                 switch ($provider->SampleRange) {
                     case '1week':
                         $startDate = date('Y-m-d H:i:s', strtotime($today) - 604800);
                         $sales = Sale::where('BranchId', '=', $branch->Id)->where('Created', '>=', $startDate)->where('Created', '<=', $today)->get();
                         foreach ($sales as $sale) {
                             $breakdown = SaleBreakdown::where('SaleId', '=', $sale->Id)->get();
                             foreach ($breakdown as $item) {
                                 if (array_key_exists($item->Code, $order)) {
                                     $order[$item->Code]['Sold'] += $item->Quantity;
                                 }
                             }
                         }
                         // Now calculate average of each product.
                         foreach ($order as $index => $product) {
                             $order[$index]['Average'] = $product['Sold'] / 7;
                         }
                         break;
                     case '2week':
                         $startDate = date('Y-m-d H:i:s', strtotime($today) - 1209600);
                         $sales = Sale::where('BranchId', '=', $branch->Id)->where('Created', '>=', $startDate)->where('Created', '<=', $today)->get();
                         foreach ($sales as $sale) {
                             $breakdown = SaleBreakdown::where('SaleId', '=', $sale->Id)->get();
                             foreach ($breakdown as $item) {
                                 if (array_key_exists($item->Code, $order)) {
                                     $order[$item->Code]['Sold'] += $item->Quantity;
                                 }
                             }
                         }
                         // Now calculate average of each product.
                         foreach ($order as $index => $product) {
                             $order[$index]['Average'] = $product['Sold'] / 14;
                         }
                         break;
                     case '1month':
                         $startDate = date('Y-m-d H:i:s', strtotime($today) - 2419200);
                         $sales = Sale::where('BranchId', '=', $branch->Id)->where('Created', '>=', $startDate)->where('Created', '<=', $today)->get();
                         foreach ($sales as $sale) {
                             $breakdown = SaleBreakdown::where('SaleId', '=', $sale->Id)->get();
                             foreach ($breakdown as $item) {
                                 if (array_key_exists($item->Code, $order)) {
                                     $order[$item->Code]['Sold'] += $item->Quantity;
                                 }
                             }
                         }
                         // Now calculate average of each product.
                         foreach ($order as $index => $product) {
                             $order[$index]['Average'] = $product['Sold'] / 30;
                         }
                         break;
                     case '3month':
                         $startDate = date('Y-m-d H:i:s', strtotime($today) - 7257600);
                         $sales = Sale::where('BranchId', '=', $branch->Id)->where('Created', '>=', $startDate)->where('Created', '<=', $today)->get();
                         foreach ($sales as $sale) {
                             $breakdown = SaleBreakdown::where('SaleId', '=', $sale->Id)->get();
                             foreach ($breakdown as $item) {
                                 if (array_key_exists($item->Code, $order)) {
                                     $order[$item->Code]['Sold'] += $item->Quantity;
                                 }
                             }
                         }
                         // Now calculate average of each product.
                         foreach ($order as $index => $product) {
                             $order[$index]['Average'] = $product['Sold'] / 90;
                         }
                         break;
                     case '1year':
                         $startDate = date('Y-m-d H:i:s', strtotime($today) - 29030400);
                         $sales = Sale::where('BranchId', '=', $branch->Id)->where('Created', '>=', $startDate)->where('Created', '<=', $today)->get();
                         foreach ($sales as $sale) {
                             $breakdown = SaleBreakdown::where('SaleId', '=', $sale->Id)->get();
                             foreach ($breakdown as $item) {
                                 if (array_key_exists($item->Code, $order)) {
                                     $order[$item->Code]['Sold'] += $item->Quantity;
                                 }
                             }
//.........这里部分代码省略.........
开发者ID:patrickdamery,项目名称:Eirene,代码行数:101,代码来源:CheckStock.php

示例12: update

 /**
  * Update the specified resource in storage.
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id = "")
 {
     //
     //
     $validator = Validator::make($request->all(), ['name' => 'required', 'city' => 'required', 'phone' => 'required']);
     if ($validator->fails()) {
         if ($request->ajax()) {
             return response()->json($validator->messages());
         } else {
             return \Redirect::back()->withErrors($validator)->withInput();
         }
     }
     array_forget($request, "_token");
     $all_request = $request->all();
     $branch = Branch::find($id);
     foreach ($all_request as $key => $value) {
         $branch->{$key} = $value;
     }
     $branch->update();
     if ($request->ajax()) {
         if ($branch->update()) {
             $branches = Branch::all();
             return response()->json("Company Successfully Updated");
             exit;
         } else {
             echo 0;
             //to signify record not saved via ajax
         }
     } else {
         //if post  is not AJAX
         if ($branch->update()) {
             \Session::flash("success_message", "Role Successfully Updated");
             return Redirect::back();
         } else {
             \Session::flash("error_message", "Unexpected Error! Role was not updated");
             return Redirect::back();
         }
     }
 }
开发者ID:runningjack,项目名称:lexmark2,代码行数:45,代码来源:BranchController.php


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