本文整理汇总了PHP中Accounts::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Accounts::select方法的具体用法?PHP Accounts::select怎么用?PHP Accounts::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accounts
的用法示例。
在下文中一共展示了Accounts::select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$input = Input::all();
$rules = array('tool_name' => 'required', 'acc_name' => 'required', 'emp_id' => 'required', 'emp_name' => 'required', 'access' => 'required');
$messages = array('tool_name.required' => 'Tool Name is required !', 'emp_id.required' => 'Employee ID is required !', 'emp_name.required' => 'Employee Name is required !', 'access.required' => 'Please select an accesibility !');
$validation = Validator::make($input, $rules, $messages);
if ($validation->passes()) {
$toolname = Accounts::select('account_name')->where('id', '=', Input::get('acc_name'))->get();
foreach ($toolname as $key => $tool) {
$accName = $tool->account_name;
}
$employees = Employee::where('emp_id', '=', $id)->select('tools.emp_id as id', 'tools.emp_name as emp_name', 'tools.acc_id as acc_id', 'tools.access as access', 'tools.tool_name as tool_name')->get();
$employees->emp_id = Input::get('emp_id');
$employees->emp_name = Input::get('emp_name');
$employees->acc_id = Input::get('acc_name');
$employees->tool_name = Input::get('tool_name');
$employees->access = Input::get('access');
//$employees->save();
DB::table('tools')->where('emp_id', $id)->update(array('emp_name' => $employees->emp_name, 'acc_id' => $employees->acc_id, 'tool_name' => $employees->tool_name, 'access' => $employees->access));
return Redirect::to('/employees');
} else {
return Redirect::to('/employees/' . $id . '/edit')->withErrors($validation);
}
}