本文整理汇总了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');
}
}
示例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);
}
示例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'));
}
示例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));
}
}
}
}
示例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;
}
示例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;
}
示例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]);
}
示例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);
}
示例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']);
}
示例10: showBranches
public function showBranches()
{
$branches = Branch::all();
$vars = array("branches" => $branches);
return view('backend.page.branch-list')->with($vars);
}
示例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;
}
}
//.........这里部分代码省略.........
示例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();
}
}
}