public function doSignUp(SignUpRequest $request) { $username = $request->get('username'); $email = $request->get('email'); $phone = $request->get('phone'); $password = $request->get('password'); $nickname = $request->has('nickname') ? $request->get('nickname') : ''; $verificationCodeForUsername = $request->get('verification_code_for_username'); $verificationCodeForPhone = $request->get('verification_code_for_phone'); $verificationCodeForEmail = $request->get('verification_code_for_email'); if ($username) { throw new NotSupportedException(NotSupportedException::FeatureOnTheWay); } if ($email) { throw new NotSupportedException(NotSupportedException::FeatureOnTheWay); } if ($phone) { throw new NotSupportedException(NotSupportedException::FeatureOnTheWay); } $user = UserManager::signUp($username, $email, $phone, $password); $user->roles()->attach(System::getDefaultRole()); $user->save(); $userInfo = new UserInfo(); $userInfo->user()->associate($user); $userInfo->save(); return $this->buildResponse(trans('api.auth.sign_up.success'), $user); }
public function run() { DB::table('users_info')->delete(); UserInfo::create(['user_id' => '1', 'style' => 'competitive', 'lang_one' => 'C++', 'lang_two' => 'Python', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '6', 'style' => 'social', 'lang_one' => 'C++', 'lang_two' => 'Python', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '4', 'style' => 'social', 'lang_one' => 'C++', 'lang_two' => 'Python', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306', 'csci_406' => 'CSCI 406']); UserInfo::create(['user_id' => '3', 'style' => 'social', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '2', 'style' => 'competitive', 'lang_one' => 'Python', 'lang_two' => 'Java', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261']); UserInfo::create(['user_id' => '5', 'style' => 'competitive', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '7', 'style' => 'competitive', 'lang_one' => 'C++', 'lang_two' => 'Python', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306', 'csci_406' => 'CSCI 406']); UserInfo::create(['user_id' => '8', 'style' => 'social', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261']); UserInfo::create(['user_id' => '9', 'style' => 'social', 'lang_one' => 'C++', 'lang_two' => 'Java', 'lang_three' => 'Python', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306']); UserInfo::create(['user_id' => '10', 'style' => 'social', 'lang_one' => 'Python', 'lang_two' => 'Java', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306']); UserInfo::create(['user_id' => '11', 'lang_one' => 'Python', 'lang_two' => 'Java', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '12', 'lang_one' => 'C++', 'lang_two' => 'Python', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306']); UserInfo::create(['user_id' => '13', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '14', 'style' => 'competitive', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306', 'csci_406' => 'CSCI 406']); UserInfo::create(['user_id' => '15', 'style' => 'competitive', 'lang_one' => 'Python', 'lang_two' => 'C++', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306', 'csci_406' => 'CSCI 406']); UserInfo::create(['user_id' => '16', 'style' => 'competitive', 'lang_one' => 'Python', 'lang_two' => 'C++', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306', 'csci_406' => 'CSCI 406']); UserInfo::create(['user_id' => '17', 'lang_one' => 'Python', 'lang_two' => 'Java', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262']); UserInfo::create(['user_id' => '18', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306', 'csci_406' => 'CSCI 406']); UserInfo::create(['user_id' => '19', 'lang_one' => 'C++', 'lang_two' => 'Java', 'lang_three' => 'Python', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306']); UserInfo::create(['user_id' => '20', 'lang_one' => 'Python', 'lang_two' => 'C++', 'lang_three' => 'Java', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306']); UserInfo::create(['user_id' => '21', 'lang_one' => 'Java', 'lang_two' => 'Python', 'lang_three' => 'C++', 'csci_261' => 'CSCI 261', 'csci_262' => 'CSCI 262', 'csci_306' => 'CSCI 306']); }
/** * @param Request $request * @param User $user * @return \Illuminate\Http\RedirectResponse */ public function postBalance(Request $request, User $user) { $this->validate($request, ['amount' => 'required|numeric']); $user_info = UserInfo::find($user->username); $user_info->pvalues = $user_info->pvalues + $request->amount; $user_info->save(); flash()->success(trans('members.success.balance', ['user' => $user->username, 'count' => $request->amount])); return redirect('admin/members/manage'); }
/** * Show a list of all available flights. * * @return Response */ public function index() { $users_info = UserInfo::all(); $out = 'Alamats: '; foreach ($users_info as $info) { $out = $out . $info->alamat; } return $out; //return view('user.index', ['users' => $users]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // get all the job $logged_user_id = Auth::user()->id; $user_info = UserInfo::find($logged_user_id); $freelancer_info = FreelancerInfo::find($user_info->user_id); $users = User::find($logged_user_id); $jobs = Job::where('freelancer_info_id', $logged_user_id)->paginate(5); // load the view and pass the jobs return View::make('job.index')->with('users', $users)->with('jobs', $jobs); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user = User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); File::makeDirectory(public_path() . "/content/" . $user->username); File::makeDirectory(public_path() . "/content/" . $user->username . "/photos/"); $dest = public_path() . "/content/" . $user->username . "/photos/profile.png"; $file = public_path() . "/img/profile.png"; File::copy($file, $dest); UserInfo::create(["user_id" => $user->id, "photo" => "/content/" . $user->username . "/photos/profile.png"]); return $user; }
public function postCheck(Request $request, VoteSite $site) { if (!VoteLog::recent($request, $site)->exists()) { $user = UserInfo::find(Auth::user()->username); $user->pvalues = $site->double_rewards ? $site->reward_amount * 2 : $site->reward_amount + $user->pvalues; $user->save(); VoteLog::create(['user_id' => Auth::user()->id, 'ip_address' => $request->ip(), 'reward' => $site->double_rewards ? $site->reward_amount * 2 : $site->reward_amount, 'site_id' => $site->id]); return redirect('vote/success/' . $site->id); } else { flash()->error(trans('vote.already_voted')); return redirect()->back(); } }
/** * Run the database seeds. * * @return void */ public function run() { $user = User::create(['username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('admin')]); $user->isAdmin = 1; $user->save(); \File::makeDirectory(public_path() . "/content/admin"); \File::makeDirectory(public_path() . "/content/admin/photos/"); $dest = public_path() . "/content/admin/photos/profile.png"; $file = public_path() . "/img/profile.png"; \File::copy($file, $dest); UserInfo::create(["user_id" => $user->id, "photo" => "/content/admin/photos/profile.png"]); //init Payment Payment::create(['stripe_publishable_key' => '', 'stripe_secret_key' => '', 'paypal_client_id' => '', 'paypal_secret' => '']); }
public function callback(SocialAccountService $service) { $providerUser = Socialite::driver('facebook')->user(); $user = $service->createOrGetUser($providerUser); $token = $providerUser->token; \Session::put('fb_user_access_token', (string) $token); auth()->login($user); $userinfo = UserInfo::find($user->id); if (empty($userinfo)) { return redirect()->to('/profile/create/info'); } else { return redirect()->to('/'); } }
public function registerUser($payload) { $email = $payload['email']; $password = $payload['password']; \DB::beginTransaction(); try { $user = User::create(['name' => User::LOCAL_NEW_USER, 'is_third' => User::THIRD_FALSE, 'email' => $email, 'password' => bcrypt($password)]); UserInfo::create(['user_id' => $user->id, 'nickname' => 'New User', 'icon_url' => 'http://s33.postimg.org/hv2ari8a7/1464809650_unknown.png']); \DB::commit(); return array('result' => true, 'content' => $user); } catch (\Exception $e) { \DB::rollBack(); return array('result' => false, 'message' => "Create new user failed!"); } }
function update($id) { $user = User::findorfail($id); $user->name = Input::get('name'); $user->email = Input::get('email'); //$user->password = Input::get('password'); //$user_info = DB::table('users_info')->where('user_id', $id)->get(); $user_info = UserInfo::where('user_id', $id)->first(); $user_info->style = Input::get('style'); $user_info->lang_one = Input::get('lang_one'); $user_info->lang_two = Input::get('lang_two'); $user_info->lang_three = Input::get('lang_three'); $user_info->csci_261 = Input::get('csci_261'); $user_info->csci_262 = Input::get('csci_262'); $user_info->csci_306 = Input::get('csci_306'); $user_info->csci_406 = Input::get('csci_406'); // save new updated information $user->save(); $user_info->save(); // redirect to /users/{id} return redirect('/users/' . $id); }
public function run() { UserInfo::truncate(); UserInfo::create(['company_name' => 'Dell', 'company_address1' => 'T Nagar', 'company_address2' => 'New York', 'city' => 'Melbourne', 'state' => 'Dubai', 'country' => 'USA', 'pin' => '4213456', 'phone' => '7234556', 'description' => 'Lifes easy', 'user_id' => 1 ]); UserInfo::create(['company_name' => '123', 'company_address1' => 'T Nagar', 'company_address2' => 'New York', 'city' => 'Melbourne', 'state' => 'Dubai', 'country' => 'USA', 'pin' => '4213456', 'phone' => '7234556', 'description' => 'Lifes easy', 'user_id' => 2]); UserInfo::create(['company_name' => 'Dell', 'company_address1' => 'T Nagar', 'company_address2' => 'New York', 'city' => 'Melbourne', 'state' => 'Dubai', 'country' => 'USA', 'pin' => '4213456', 'phone' => '7234556', 'description' => 'Lifes easy', 'user_id' => 3]); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); $id = $user->id; $c261 = null; $c262 = null; $c306 = null; $c406 = null; if (!empty($data['csci_261'])) { $c261 = 'CSCI 261'; } if (!empty($data['csci_262'])) { $c262 = 'CSCI 262'; } if (!empty($data['csci_306'])) { $c306 = 'CSCI 306'; } if (!empty($data['csci_406'])) { $c406 = 'CSCI 406'; } UserInfo::create(['user_id' => $id, 'style' => $data['style'], 'lang_one' => $data['lang_one'], 'lang_two' => $data['lang_two'], 'lang_three' => $data['lang_three'], 'csci_261' => $c261, 'csci_262' => $c262, 'csci_306' => $c306, 'csci_406' => $c406]); return $user; }
/** * Show all job request for the logged-in user * * @return Response */ public function showAllRequest() { // get all his/her job $logged_user_id = Auth::user()->id; $user_info = UserInfo::find($logged_user_id); $freelancer_info = FreelancerInfo::find($user_info->user_id); $jobs = Job::where('freelancer_info_id', $freelancer_info->user_info_id)->get(); $query = "SELECT jr.job_id, jr.seeker_id, j.deskripsi "; $query = $query . "FROM job_request jr, job j "; $query = $query . "WHERE j.freelancer_info_id = " . $freelancer_info->user_info_id . " and j.id = jr.job_id"; $job_requests = DB::select(DB::raw($query)); $job_requests_data = []; foreach ($job_requests as $a_job_req => $value) { # code... $job_id = $value->job_id; $job_deskripsi = $value->deskripsi; $seeker_id = $value->seeker_id; $seeker_email = User::find($seeker_id)->email; $a_job_req_data = array('job_id' => $job_id, 'job_deskripsi' => $job_deskripsi, 'seeker_id' => $seeker_id, 'seeker_email' => $seeker_email); array_push($job_requests_data, $a_job_req_data); } return View::make('job.requests')->with('job_requests_data', $job_requests_data); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); UserInfo::create(['user_id' => $user->id, 'tanggal_lahir' => $data['tanggal_lahir'], 'alamat' => $data['alamat'], 'jenis_kelamin' => $data['jenis_kelamin']]); return $user; }
/** * Process the PaymentWall payment * * @param Request $request */ public function getPaymentWall(Request $request) { $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']); if ($pingback->validate()) { $virtualCurrency = $pingback->getVirtualCurrencyAmount(); $user = UserInfo::find($request->uid); if ($pingback->isDeliverable()) { // Add the currency to the user $user->pvalues = $user->pvalues + $virtualCurrency; $user->save(); } elseif ($pingback->isCancelable()) { // Take the currency from the user $user->pvalues = $user->pvalues + $virtualCurrency; $user->save(); } echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent } else { echo $pingback->getErrorSummary(); } }
public function directToProfile($id) { $user_info = UserInfo::find($id); $users = User::find($id); $alamat = $user_info->alamat; $tanggal_lahir = $user_info->tanggal_lahir; $jenis_kelamin = $user_info->jenis_kelamin; $nama = $users->name; $user_info = UserInfo::find($id); $freelancer_info = FreelancerInfo::find($user_info->user_id); $skills = FreelancerInfoSkill::where('freelancer_info_id', $id)->get(); return View::make('profile')->with('user_info', $user_info)->with('users', $users)->with('skills', $skills)->with('id', $id); }
public function editInfo(Request $request) { UserInfo::where('user_id', Auth::user()->id)->update($request->except('_token')); return \Redirect()->back()->with(['flash_message' => 'Successfully saved !']); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // $user = User::find($id); $userinfo = UserInfo::find($id); $user->name = Input::get('name'); $user->email = Input::get('email'); $userinfo->tanggal_lahir = Input::get('tanggal_lahir'); $userinfo->alamat = Input::get('alamat'); $userinfo->jenis_kelamin = Input::get('jenis_kelamin'); $user->save(); $userinfo->save(); return Redirect::to('/admin/manage/user'); }
return redirect()->back(); // redirect back if current user tries to access another user } $user_info = UserInfo::where('user_id', $id)->first(); $user = User::findorfail($id); return view('pages/edit', compact('user', 'user_info')); }); Route::post('/users/{id}/edit', 'UserController@update'); // Password routes Route::controllers(['password' => 'Auth\\PasswordController']); // Admin routes - only accessible by admin user Route::group(['middleware' => 'App\\Http\\Middleware\\AdminMiddleware'], function () { Route::get('/admin', function () { $users = User::all(); $users_info = UserInfo::all(); $numTeams = count(Team::all()); $nullteam = UserInfo::where('team_id', null)->first(); return view('admin.teams', compact('users_info', 'users', 'numTeams', 'nullteam')); }); Route::post('/admin', 'AdminController@generate'); Route::get('/admin/generate', function () { return view('admin.generate'); }); Route::get('/admin/users/{id}', function ($id) { $user = User::findorfail($id); $userinfo = UserInfo::findorfail($id); $numTeams = count(Team::all()); return view('admin.user', compact('user', 'userinfo', 'numTeams')); }); Route::post('/admin/users/{id}', 'AdminController@edit'); });
function edit($id) { $user = User::findOrFail($id); $user_info = UserInfo::findOrFail($id); $new_team = $_POST['team_id']; if ($new_team === '') { $new_team = null; // or 'NULL' for SQL } $user_info->team_id = $new_team; $user_info->save(); return redirect('/admin'); }