本文整理匯總了PHP中app\Employee::lists方法的典型用法代碼示例。如果您正苦於以下問題:PHP Employee::lists方法的具體用法?PHP Employee::lists怎麽用?PHP Employee::lists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Employee
的用法示例。
在下文中一共展示了Employee::lists方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
public function edit($salarySheetId, $salarySheetRecordId)
{
$salary_sheet = SalarySheet::find($salarySheetId);
$employees = Employee::lists('name', 'id')->sort();
$salary_sheet_record = SalarySheetRecord::find($salarySheetRecordId);
return view('hr.salary_sheet.edit', compact('salary_sheet', 'employees', 'salary_sheet_record'));
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$order_states = OrderState::lists('id')->toArray();
$customer_ids = Customer::lists('id')->toArray();
$employee_ids = Employee::lists('id')->toArray();
$products = Product::all();
factory(App\Order::class, 80)->create()->each(function ($order) use($customer_ids, $employee_ids, $order_states, $products) {
$order->products()->attach($products->shuffle()->first(), ['quantity' => rand(1, 30), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
$order->ordered_by = shuffle($customer_ids)[0];
$order->acquired_by = shuffle($employee_ids)[0];
$order_key = array_rand($order_states);
$order->state_id = $order_states[$order_key];
});
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$salary_sheet = SalarySheet::find($id);
$employees = Employee::lists('name', 'id')->sort();
return view('hr.salary_sheet.show', compact('salary_sheet', 'employees'));
}