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')); }
/** * 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]; }); }
/** * 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')); }