本文整理汇总了PHP中app\Company::listAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::listAll方法的具体用法?PHP Company::listAll怎么用?PHP Company::listAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Company
的用法示例。
在下文中一共展示了Company::listAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index(Request $request)
{
$start_time = $request->get('start') ? date("Y-m-d", strtotime($request->get('start') . " -1 day")) : date("Y-m-d", strtotime("-1 month -1 day"));
$end_time = $request->get('end') ? date("Y-m-d", strtotime($request->get('end') . " +1 day")) : date("Y-m-d", strtotime("+1 day"));
if (Auth::user()->role == "supadmin") {
$company_id = $request->get('company_id');
} else {
$company_id = $this->company_id[0];
}
$currency = $company_id != null ? Company::find($company_id)->currency->title : null;
if (Auth::user()->role == "supadmin") {
$data = Payment::users($company_id, $start_time, $end_time);
} else {
$data = Payment::users($this->company_id[0], $start_time, $end_time);
}
return view('payment.list_users')->with(['data' => $data, 'currency' => $currency, 'companies' => Company::listAll()]);
}
示例2: index
public function index(Request $request)
{
if (Auth::user()->role == "supadmin") {
$company_id = $request->get('company_id');
} elseif (Auth::user()->role == "worker") {
$company_id = implode(",", $this->company_id);
} else {
$company_id = $this->company_id[0];
}
$start_shift = $end_shift = "00:00";
if ($company_id && Auth::user()->role != "worker") {
$start_shift = Company::find($company_id)->shift_day_start;
$end_shift = Company::find($company_id)->shift_night_start;
}
$companies = Company::listAll();
$workers = Company::workers($company_id);
return view('rosters.list')->with(['company_id' => $company_id, 'shift_start' => $start_shift, 'shift_end' => $end_shift, 'workers' => $workers, 'companies' => $companies]);
}
示例3: edit
public function edit($id = null)
{
if ($id == null) {
$id = Auth::user()->id;
}
$companies = Company::listAll();
$user = User::find($id);
return view('users.edit')->with(['companies' => $companies, 'user' => $user]);
}