/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { /*$data = Input::all(); echo "<pre>"; print_r($data);die;*/ $receptionist = Receptionist::findOrFail(Input::get('id')); $receptionist->first_name = Input::get('first_name'); $receptionist->last_name = Input::get('last_name'); $receptionist->name = Input::get('first_name') . ' ' . Input::get('last_name'); $receptionist->email = Input::get('email'); $receptionist->location_id = Input::get('location_id'); /*$receptionist->password = bcrypt(Input::get('password')); $receptionist->password_org = Input::get('password');*/ $receptionist->status = 1; $receptionist->role_id = 3; if (Input::get('attachFile')) { $filename = Input::get('attachFile'); $extension = substr(strrchr($filename, '.'), 1); $imageName = Input::get('id') . '.' . $extension; $receptionist->avatar = $imageName; } else { $receptionist->avatar = Input::get('avatar'); } /*$avatar_val = Input::file('avatar'); if(!empty($avatar_val)){ $extension = Input::file('avatar')->getClientOriginalExtension(); $imageName = Input::get('id') . '.' . $extension; Input::file('avatar')->move(base_path() . '/public/uploads/avatar/', $imageName); $receptionist->avatar = $imageName; }*/ $receptionist->save(); return Response::json(array('success' => 'Receptionist has been updated!')); }
public function handleDeleteReceptionist() { // Handle the delete confirmation. $id = Input::get('receptionist'); $receptionist = Receptionist::findOrFail($id); $receptionist->delete(); return Redirect::action('CommonController@receptionists'); }