public function getProfile(Request $request) { $id = $request->input('id'); $profile = Profile::find($id); $profile->delete(); return response()->json(['status' => 'valid']); }
/** * Run the database seeds. * * @return void */ public function run() { // Profile::truncate(); if (!Profile::find(1)) { DB::table('profiles')->insert(['user_id' => 1, 'first_name' => 'Uriah', 'last_name' => 'Galang', 'profile_pic' => '/img/avatar.png', 'about_me' => 'Im Your Admin', 'display_name' => 'Master Powers', 'contact_no' => '12345678900', 'address' => 'NPA', 'city' => 'Los Angeles', 'province_state' => 'California', 'zip_code' => '2200', 'country' => 'Uranus', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]); } // $faker = Faker\Factory::create(); // foreach (range(2, 51) as $index) { // Profile::create([ // 'user_id' => $index, // 'first_name' => $faker->firstName, // 'last_name' => $faker->lastName, // 'profile_pic' => $faker->imageUrl($width = 125, $height = 125), // 'about_me' => $faker->paragraph(5), // 'display_name' => $faker->name, // 'contact_no' => $faker->phoneNumber, // 'address' => $faker->streetAddress, // 'city' => $faker->city, // 'province_state' => $faker->state, // 'zip_code' => $faker->postcode, // 'country' => $faker->country, // 'created_at' => \Carbon\Carbon::now(), // 'updated_at' => \Carbon\Carbon::now(), // ]); // } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $data = ['first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'address' => Input::get('address'), 'pin' => Input::get('pin'), 'emirate_id' => Input::get('emirate_id'), 'phone' => Input::get('phone')]; // return response()->json($data); Profile::find($id)->update($data); return redirect('/home'); }
/** Save a naw post * @param Request $request * @return Response of the ajax request. */ public function store(Request $request) { //ajax storage. //1. check if its out form. if (Session::token() !== Input::get('_token')) { return response()->json(array('message' => 'unauthorized attempt to sent a post')); } //get the oldest post id. this will be used to append to the post ul. $old_post = DB::table('posts')->max('id'); //2. retreive the data in the form. $post = new Post(); $post->title = Input::get('title'); $post->body = Input::get('body'); $post->post_author_id = Auth::id(); if ($post->save()) { //get the profile image of the use. $profile_image_name = Profile::find(Auth::id())->pluck('profile_image_name'); // create a json response and return it. $response = array('title' => $post->title, 'body' => $post->body, 'post_author_id' => $post->post_author_id, 'user_id' => Auth::id(), 'profile_image_name' => $profile_image_name, 'post_id' => $post->id, 'old_post' => $old_post, 'nickname' => $request->user()->nickname, 'message' => 'Your message has been posted', 'status' => 'success'); return response()->json($response, 200); } else { //500 = Internal server error return response('Sorry, An Error Occurred. Please retry the request', 500); } }
/** * Allow admin to update specific profile. * * @param $id * @param ProfileRequest $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function sudoUpdate($id, ProfileRequest $request) { $input = $request->all(); $profile = Profile::find($id); $profile->update($input); return redirect('profile/' . $id); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $user = User::find($id); $profile = Profile::find($user->id); $posts = Post::find($user); TrackerFunctions::log($user->name . " is viewing their own profile "); return view('profiles.default', compact('user', 'posts', 'profile')); }
public function getApproveProfile($profileId) { $profile = Profile::find($profileId); $profile->checked = 1; $profile->isActive = 1; $profile->save(); return redirect('admin/index'); }
public function getProfile($id) { $profile = Profile::find($id); $posts = $profile->user->posts()->orderBy('id', 'DESC')->get(); $first_number = rand(1, 10); $second_number = rand(1, 10); return view('profile.profile_user', compact('posts', 'profile', 'first_number', 'second_number')); }
public function about() { $data = Profile::find(auth()->user()->get('account_id')); /** TODO: Довърши страницата about */ return view('pages.profile.about')->with('data', $data); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { if (Gate::denies('admin')) { abort(403); } $profile = Profile::find($id); return view('profiles.show', ['profile' => $profile]); }
public function EditProfile($request) { $this->request = $request->all(); unset($this->request["access_token"]); unset($this->request["client_id"]); $profile = Profile::find($this->request["id"]); $profile->update($this->request); return $profile; }
public function setting($id) { //$accout = Accout::find($id); $accout = DB::table('users')->find($id); $ids = $accout->id; $user = Profile::find($accout->profile_id); return view('pages.setting', compact('user', 'ids')); //$profile = App\Profile::find($accout->profile_id); // return view('pages.setting',compact('user'))->with('user', Profile::find($accout->profile_id) ); }
public function getRegister() { $switch = DB::table('xt')->where('c_id', '=', 'XS_DEXWBM')->first(); if ($switch->c_value == 0) { return redirect('user/ban')->with('message', '现在还没有开放双学士学位教育网上报名,以便确认您的修读资格,谢谢。'); } $profile = Profile::find(Auth::user()->xh); if (is_null($profile)) { return redirect('user/ban')->with('message', '双学士学位教育只限在校学生报名,其它学籍状态的同学如果需要报名,请直接联系相关学院,其联系方式见《广西师范大学2015年“双学士学位”教育招生简章》,以便确认您的修读资格,谢谢。'); } if ($profile->nj != '2014') { return redirect('user/ban')->with('message', '2015年双学士学位教育只限2014级学生报名,其它年级的同学如果需要报名,请直接联系相关学院,其联系方式见《广西师范大学2015年“双学士学位”教育招生简章》,以便确认您的修读资格,谢谢。'); } $majors = DB::table('xt_zybh')->join('jx_jxjh', 'jx_jxjh.c_zy', '=', 'xt_zybh.c_zy')->where('jx_jxjh.c_nj', '=', $profile->nj + 2)->where('jx_jxjh.c_zsjj', '=', '0')->select('xt_zybh.c_zy', 'xt_zybh.c_mc')->orderBy('xt_zybh.c_zy')->distinct()->get(); $student = DB::table('xs_xsb')->join('xt_zybh', 'xt_zybh.c_zy', '=', 'xs_xsb.c_zyh')->join('xt_yxzy', 'xt_yxzy.c_zy', '=', 'xt_zybh.c_zy')->join('xt_yxbh', 'xt_yxbh.c_xb', '=', 'xt_yxzy.c_yx')->select('c_xh', 'c_xm', 'c_zyh', 'c_lxdh', 'c_sfzh', 'xt_zybh.c_mc as zymc', 'xt_yxbh.c_mc as yxmc')->where('c_xh', '=', Auth::user()->xh)->first(); return view('register', ['title' => '广西师范大学双学位报名系统', 'profile' => $profile, 'majors' => $majors, 'student' => $student]); }
public function process(Request $request) { $profile = Profile::find($request->input('profile_id')); $response = $request->input('response', 0); $message = null; if ($response > 0) { if ($response == 1 || $response == 2) { $message = "Congratulations! You have successfully voted for " . $profile->name . " as miss/mister rwanda belgium 2016"; Flash::success($message); } if ($response == 3) { $message == "There's an error, Please try again later..."; Flash::error($message); } if ($response == 4) { $message = "Oops.. You can only vote one time in five minutes, try again in 5 minutes"; Flash::warning($message); } } return redirect('/'); }
/** * Handle the event. * * @param \App\Events\WechatUserSubscribed $event * @return \App\Models\Message */ public function handle(WechatUserSubscribed $event) { $m = $event->message; /** * openId is always unique to our official account, so if user subscribes * again, we just need to toggle un-subscribed flag. */ if ($subscriber = Subscriber::where('openId', $m->fromUserName)->where('unsubscribed', true)->first()) { $subscriber->unsubscribed = false; } else { $subscriber = new Subscriber(); $subscriber->openId = $m->fromUserName; } $subscriber->save(); // Link profile with subscriber if subscribe comes from profile page. if ($key = $m->messageable->eventKey) { Profile::find(Str::substr($key, Str::length('qrscene_')))->update(['weixin' => $m->fromUserName]); event(new ChangeSubscriberGroup($subscriber)); } return $this->greetMessage($m->fromUserName, !is_null($key)); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $profile = Profile::find($id); // Delete Profile and redirect }
/** * @return bool * * Track all round record into Database. */ public function track() { /** * @var Game */ $game = new Game(); $game->tag = $this->roundTag; $game->server_time = $this->serverTime; $game->round_time = $this->timePlayed; $game->round_index = $this->roundIndex + 1 . " / " . $this->roundLimit; $game->gametype = $this->gameType; $game->outcome = $this->roundOutcome; $game->map_id = $this->gameMap; $game->total_players = $this->totalPlayers; $game->swat_score = $this->swatScore; $game->suspects_score = $this->suspectsScore; $game->swat_vict = $this->swatVictory; $game->suspects_vict = $this->suspectsVictory; if (!$game->save()) { return false; } /** * Iterate over each player array */ foreach ($this->players as $p) { /** * @var Player */ $player = new Player(); $player->ingame_id = $p[0]; $player->ip_address = $p[1]; $player->name = str_replace('(VIEW)', '', $p[5]); $player->name = str_replace('(SPEC)', '', $player->name); $player->team = array_key_exists(6, $p) ? $p[6] : 0; $player->is_admin = array_key_exists(3, $p) ? $p[3] : 0; $player->is_dropped = array_key_exists(2, $p) ? $p[2] : 0; $player->score = array_key_exists(8, $p) ? $p[8] : 0; $player->time_played = array_key_exists(7, $p) ? $p[7] : 0; $player->kills = array_key_exists(9, $p) ? $p[9] : 0; $player->team_kills = array_key_exists(10, $p) ? $p[10] : 0; $player->deaths = array_key_exists(11, $p) ? $p[11] : 0; $player->suicides = array_key_exists(12, $p) ? $p[12] : 0; $player->arrests = array_key_exists(13, $p) ? $p[13] : 0; $player->arrested = array_key_exists(14, $p) ? $p[14] : 0; $player->kill_streak = array_key_exists(15, $p) ? $p[15] : 0; $player->arrest_streak = array_key_exists(16, $p) ? $p[16] : 0; $player->death_streak = array_key_exists(17, $p) ? $p[17] : 0; $player->game_id = $game->id; $player_ip_trim = substr($p[1], 0, strrpos($p[1], ".")); $player_country_id = 0; $geoip = App::make('geoip'); try { if ($player_geoip = $geoip->city($player->ip_address)) { $player_isoCode = $player_geoip->country->isoCode; $country = Country::where('countryCode', 'LIKE', $player_isoCode)->first(); /** * Country returned is not in Countrie table */ if ($country == null) { $player_country_id = 0; } else { $player_country_id = $country->id; } } } catch (\Exception $e) { switch ($e) { case $e instanceof \InvalidArgumentException: $player_country_id = 0; break; case $e instanceof \GeoIp2\Exception\AddressNotFoundException: $player_country_id = 0; break; default: $player_country_id = 0; break; } } $loadout_array = array_key_exists(39, $p) ? $p[39] : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; /** * @var Loadout * * Create or find and return instance of Loadout and save to database. */ $loadout = Loadout::firstOrCreate(['primary_weapon' => array_key_exists(0, $loadout_array) ? $loadout_array[0] : 0, 'primary_ammo' => array_key_exists(1, $loadout_array) ? $loadout_array[1] : 0, 'secondary_weapon' => array_key_exists(2, $loadout_array) ? $loadout_array[2] : 0, 'secondary_ammo' => array_key_exists(3, $loadout_array) ? $loadout_array[3] : 0, 'equip_one' => array_key_exists(4, $loadout_array) ? $loadout_array[4] : 0, 'equip_two' => array_key_exists(5, $loadout_array) ? $loadout_array[5] : 0, 'equip_three' => array_key_exists(6, $loadout_array) ? $loadout_array[6] : 0, 'equip_four' => array_key_exists(7, $loadout_array) ? $loadout_array[7] : 0, 'equip_five' => array_key_exists(8, $loadout_array) ? $loadout_array[8] : 0, 'breacher' => array_key_exists(9, $loadout_array) ? $loadout_array[9] : 0, 'body' => array_key_exists(10, $loadout_array) ? $loadout_array[10] : 0, 'head' => array_key_exists(11, $loadout_array) ? $loadout_array[11] : 0]); /** * Create or find and return instance of Alias. */ $alias = Alias::firstOrNew(['name' => $player->name]); /** * If Alias is not present then new instance is created. */ if ($alias->id == null) { //$profile = Profile::firstOrNew(['ip_address' => $player_ip_trim.'%']); $profile = Profile::where('ip_address', 'LIKE', $player_ip_trim . '%')->first(); // If no profile present create new else ignore. if (!$profile) { $profile = new Profile(); } /** * Neither Alias not Profile is present. * * So it will create both new Alias and Profile. */ if ($profile->id == null) { $profile->name = $player->name; $profile->team = $player->team; $profile->country_id = $player_country_id; $profile->loadout_id = $loadout->id; $profile->game_first = $game->id; $profile->game_last = $game->id; $profile->ip_address = $player->ip_address; $profile->save(); $alias->name = $player->name; $alias->profile_id = $profile->id; $alias->ip_address = $player->ip_address; $alias->save(); } else { $alias->name = $player->name; $alias->profile_id = $profile->id; $alias->ip_address = $player->ip_address; $alias->save(); $profile->team = $player->team; $profile->game_last = $game->id; $profile->loadout_id = $loadout->id; $profile->ip_address = $player->ip_address; $profile->country_id = $player_country_id; $profile->save(); } } else { $profile = Profile::find($alias->profile_id); $profile->team = $player->team; $profile->game_last = $game->id; $profile->loadout_id = $loadout->id; $profile->ip_address = $player->ip_address; $profile->country_id = $player_country_id; $profile->save(); $alias->ip_address = $player->ip_address; $alias->save(); } $player->alias_id = $alias->id; $player->loadout_id = $loadout->id; $player->country_id = $player_country_id; $player->save(); /** * Iterate over all Weapon of each Player if exists */ if (array_key_exists(40, $p)) { foreach ($p[40] as $w) { $weapon = new Weapon(); $weapon->name = $w[0]; $weapon->player_id = $player->id; $weapon->seconds_used = array_key_exists(1, $w) ? $w[1] : 0; $weapon->shots_fired = array_key_exists(2, $w) ? $w[2] : 0; $weapon->shots_hit = array_key_exists(3, $w) ? $w[3] : 0; $weapon->shots_teamhit = array_key_exists(4, $w) ? $w[4] : 0; $weapon->kills = array_key_exists(5, $w) ? $w[5] : 0; $weapon->teamkills = array_key_exists(6, $w) ? $w[6] : 0; $weapon->distance = array_key_exists(7, $w) ? $w[7] : 0; $weapon->save(); } } } //$pt = new App\Server\Repositories\PlayerTotalRepository(); //$pt->calculate(); //$response = Response::make("0\\nStats has been successfully tracked",200); printf("%s", "0\nRound report tracked."); exit(0); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $profile = !is_null($this->user) && $this->user->is_admin ? Profile::find($id) : Profile::visible()->find($id); return view('profiles.show', compact('profile')); }
public function updateProfilePic(Request $request) { $input = $request->all(); // VALIDATION RULES $rules = array('attachment' => 'image|max:3000'); // PASS THE INPUT AND RULES INTO THE VALIDATOR $validation = Validator::make($input, $rules); // CHECK GIVEN DATA IS VALID OR NOT if ($validation->fails()) { // return Redirect::to('/')->with('message', $validation->errors->first()); return response()->json(['success' => false, 'message' => 'validation failed!'], 400); } $file = array_get($input, 'attachment'); // SET UPLOAD PATH $destinationPath = 'uploads'; // GET THE FILE EXTENSION $extension = $file->getClientOriginalExtension(); // RENAME THE UPLOAD WITH RANDOM NUMBER $fileName = rand(11111, 99999) . str_random(12) . '.' . $extension; $profilepic = $destinationPath . '/' . $fileName; // MOVE THE UPLOADED FILES TO THE DESTINATION DIRECTORY $upload_success = $file->move($destinationPath, $fileName); $profile = Profile::find($request->input('id')); // Assign Old File Variable $oldfile = $profile->profile_pic; // Delete Old Receipt if There is if ($oldfile) { \File::delete($profile->profile_pic); } // Attach the New Receipt $profile->profile_pic = $profilepic; $profile->save(); $data['profile_pic'] = $profile->profile_pic; // IF UPLOAD IS SUCCESSFUL SEND SUCCESS MESSAGE OTHERWISE SEND ERROR MESSAGE if ($upload_success) { // return Redirect::to('/')->with('message', 'Image uploaded successfully'); return response()->json(['html' => \View::make('layouts.forms.profilepic')->with(compact('data'))->render(), 'success' => true, 'message' => 'Uploaded Successfully!'], 200); } }
public function CompleteTrade() { $userRep = new UsersRepository(); $portfolioRep = new PortfoliosRepository(); $id = Input::get('id'); $user = Auth::user(); if ($user) { $trade = Trade::find($id); $portfolio = Portfolio::find($trade->portfolio_id); if ($portfolio->user_id == Auth::user()->id && $trade->is_active) { $profile = Profile::find($trade->profile_id); $trade->is_active = false; $trade->price_sold = $profile->current_price; $trade->save(); $price = $profile->current_price * $trade->shares_taken; $portfolioRep->IncreaseBalance($portfolio, $price); return response()->json(array('success' => true, 'portfolioId' => $portfolio->id, 'price' => $price)); } } return response()->json(array('success' => false)); }
public function destroy($id) { $profile = Profile::find($id); return $profile->delete(); }
public function profile($id) { $profile = Profile::find($id); return view('guest.profile')->with('profile', $profile); }
public static function saveImageInDB(Request $request, $name) { try { $profile = Profile::find($request->user()->id)->firstOrFail(); $profile->profile_image_name = $name; return $profile->save(); } catch (ModelNotFoundException $e) { return false; } }
public function carianPost() { $profile = Profile::find(Request::get('no_anggota'))->first(); // dd($profiles); return View('members.laporan.kadAhli', compact('bil', 'profile')); }
public function GetProfileById($id) { return Profile::find($id); }
public function GetProfile($profile_id) { return Profile::find($profile_id); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $deleteableProfile = Profile::find($id); $deleteableProfile->delete(); return $deleteableProfile; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Profile::find($id)->delete(); return redirect('profile/management')->with('message', 'delete successfully'); }
/** * Update the specified Profiles in storage. * @param int $id * @param UpdateProfilesRequest $request * @return Response */ public function update($id, UpdateProfilesRequest $request) { $profiles = $this->profilesRepository->find($id); if (empty($profiles)) { Flash::error('Profiles not found'); return redirect(route('profiles.index')); } $docfrente = $profiles->docfrente; $docverso = $profiles->docverso; $foto = $profiles->foto; $docfrenteNovo = $request->docfrente; $docversoNovo = $request->docverso; $fotoNovo = $request->foto; $profiles = $this->profilesRepository->updateRich($request->all(), $id); $profile = \App\Profile::find($id); if ($docfrenteNovo) { if ($docfrente) { if (\File::exists(base_path() . '/public/images/' . $docfrente)) { \File::Delete(base_path() . '/public/images/' . $docfrente); } } $extdocfrente = pathinfo(Input::file('docfrente')->getClientOriginalName()); $nomedocfrente = ProfilesController::getRandomHex(24) . '.' . trim(strtolower($extdocfrente['extension'])); Image::make(Input::file('docfrente'))->save(base_path() . '/public/images/profile' . $id . '-' . $nomedocfrente); $profile->docfrente = 'profile' . $id . '-' . $nomedocfrente; } if ($docversoNovo) { if ($docverso) { if (\File::exists(base_path() . '/public/images/' . $docverso)) { \File::Delete(base_path() . '/public/images/' . $docverso); } } $extdocverso = pathinfo(Input::file('docverso')->getClientOriginalName()); $nomedocverso = ProfilesController::getRandomHex(24) . '.' . trim(strtolower($extdocverso['extension'])); Image::make(Input::file('docverso'))->save(base_path() . '/public/images/profile' . $id . '-' . $nomedocverso); $profile->docverso = 'profile' . $id . '-' . $nomedocverso; } if ($fotoNovo) { if ($foto) { if (\File::exists(base_path() . '/public/images/' . $foto)) { \File::Delete(base_path() . '/public/images/' . $foto); } } $extfoto = pathinfo(Input::file('foto')->getClientOriginalName()); $nomefoto = ProfilesController::getRandomHex(24) . '.' . trim(strtolower($extfoto['extension'])); Image::make(Input::file('foto'))->save(base_path() . '/public/images/profile' . $id . '-' . $nomefoto); $profile->foto = 'profile' . $id . '-' . $nomefoto; } $profile->save(); Flash::success('Profiles updated successfully.'); return redirect(route('profiles.index')); }