public function post_profile() { $input = Input::all(); // $validation = Admin_UserProfile::validate($input); // if( $validation->fails() ) { // return Redirect::to('user/profile')->with_errors($validation)->with_input(); // } // $extension = File::extension($input['photo']['name']); // $directory = path('public').'avatar/'.sha1(Auth::user()->userid); // $filename = sha1(Auth::user()->userid.time()).".{$extension}"; $profile = Admin_UserProfile::find(Auth::user()->userid); // if($input['photo']['size'] != null){ // $upload_success = Input::upload('photo', $directory, $filename); // if( $upload_success ) { // while(is_file('public/'.$profile->imgpath) == TRUE) // { // chmod('public/'.$profile->imgpath, 0666); // unlink('public/'.$profile->imgpath); // } // $profile->imgpath = 'avatar/'.sha1(Auth::user()->userid).'/'.$filename; // } // } $profile->fullname = $input['fullname']; $profile->dob = date('Y-m-d', strtotime($input['dob'])); $profile->address = $input['address']; $profile->postcode = $input['postcode']; $profile->emel = $input['emel']; $profile->town = $input['town']; $profile->city = $input['city']; $profile->icno = $input['icno']; $profile->save(); $profile = Admin_UserProfile::loggedprofile(); return $profile; }