/** * Show the form for editing the specified branch. * * @param int $id * @return Response */ public function edit($id) { $eallw = EAllowances::find($id); $employees = Employee::all(); $allowances = Allowance::all(); return View::make('employee_allowances.edit', compact('eallw', 'allowances', 'employees')); }
$objValidation->setErrorTitle('Input error'); $objValidation->setError('Value is not in list.'); $objValidation->setPromptTitle('Pick from list'); $objValidation->setPrompt('Please pick a value from the drop-down list.'); $objValidation->setFormula1('"' . $emplist . '"'); //note this! } }); })->export('xls'); }); /* *allowance template * */ Route::get('template/allowances', function () { $data = Allowance::all(); $employees = Employee::all(); Excel::create('Allowances', function ($excel) use($data, $employees) { require_once base_path() . "/vendor/phpoffice/phpexcel/Classes/PHPExcel/NamedRange.php"; require_once base_path() . "/vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataValidation.php"; $excel->sheet('allowances', function ($sheet) use($data, $employees) { $sheet->row(1, array('EMPLOYEE', 'ALLOWANCE TYPE', 'AMOUNT')); $empdata = array(); foreach ($employees as $d) { $empdata[] = $d->personal_file_number . ':' . $d->first_name . ' ' . $d->last_name . ' ' . $d->middle_name; } $emplist = implode(", ", $empdata); $listdata = array(); foreach ($data as $d) { $listdata[] = $d->allowance_name; }
/** * Remove the specified branch from storage. * * @param int $id * @return Response */ public function destroy($id) { $allowance = Allowance::findOrFail($id); Allowance::destroy($id); Audit::logaudit('Allowances', 'delete', 'deleted: ' . $allowance->allowance_name); return Redirect::route('allowances.index'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('allowances')->delete(); $allowance = [['weekday_nominal' => 20000, 'weekend_nominal' => 5000, 'cut_nominal' => 5000, 'information' => '>= 8 jam weekday'], ['weekday_nominal' => 15000, 'weekend_nominal' => 5000, 'cut_nominal' => 5000, 'information' => '>= 7 jam < 8 jam weekday'], ['weekday_nominal' => 10000, 'weekend_nominal' => 5000, 'cut_nominal' => 5000, 'information' => '< 7 jam weekday']]; Allowance::insert($allowance); }
public function applyChange() { $param = Input::all(); $allowance = Allowance::find($param['id']); $allowance->edit($param); return Response::json(array('valid' => TRUE)); }