本文整理匯總了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]);
}