public static function loggedprofile() { $logged_user = Auth::user(); $userInfo = User::find($logged_user->userid)->userprofile; $data['profileid'] = $userInfo->profileid; $data['fullname'] = $userInfo->fullname; $data['icno'] = $userInfo->icno; $data['emel'] = $userInfo->emel; return json_encode($data); }
public static function updateUser($input) { $user = User::find($input['userid']); $profileid = $user->userprofile->profileid; $user->role = $input['role']; $user->status = $input['status']; $user->save(); $prof = array(array('fullname' => $input['fullname'], 'icno' => $input['icno'], 'emel' => $input['emel'])); $profile = Profile::find($profileid); $profile->fullname = $input['fullname']; $profile->icno = $input['icno']; $profile->emel = $input['emel']; $profile->save(); $profile = User::find($input['userid']); Log::write('User', 'Update User ' . $user->userprofile->icno . 'By ' . Auth::user()->username); }