本文整理汇总了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'));
}