public function getPreview() { $profile = Profile::where("user_id", "=", Auth::id())->first(); if (!$profile) { return redirect('/register'); } else { if ($profile->isActive == 1) { return redirect('/profile/index/' . $profile->id); } } $photos = []; if ($profile->photo1 != "") { $photos[] = $profile->photo1; } if ($profile->photo2 != "") { $photos[] = $profile->photo2; } if ($profile->photo3 != "") { $photos[] = $profile->photo3; } if ($profile->photo4 != "") { $photos[] = $profile->photo4; } if ($profile->photo5 != "") { $photos[] = $profile->photo5; } $data = array('selectedPage' => 2, 'profile' => Profile::where("user_id", "=", Auth::id())->first(), 'user' => Auth::user(), 'pageUrl' => $_ENV['BASE_FB_URL'] . 'profile/index/' . $profile->id, 'photos' => $photos); return view('register.preview', $data); }
public function multiple(Request $request) { if (!$request->has('toCall')) { return response()->json(['error' => 'nope'], 400); } $input = $request->all(); $toCall = json_decode($input['toCall']); foreach ($toCall as $id) { $profile = \App\Profile::where('id', '=', $id)->get()->first(); $post_data = ['From' => '0' . $profile->phone, 'CallerId' => '07930447021', 'Url' => 'http://my.exotel.in/exoml/start/56809', 'CallType' => 'trans']; $exotel_sid = 'ruralfuse'; // Your Exotel SID - Get it here: http://my.exotel.in/Exotel/settings/site#exotel-settings $exotel_token = '072f910fe7c604a3aba59c768a78e1d498ba17fe'; // Your exotel token - Get it here: http://my.exotel.in/Exotel/settings/site#exotel-settings $url = "https://" . $exotel_sid . ":" . $exotel_token . "@twilix.exotel.in/v1/Accounts/" . $exotel_sid . "/Calls/connect"; $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data)); $http_result = curl_exec($ch); $error = curl_error($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } }
public function get($userId) { // $profiles = Profile::find($userId); $profiles = Profile::where('userId', $userId)->first(); return $profiles; // return array('name' => 'Sheldon Nofer'); }
public function noAnggota() { $profiles = Profile::where('no_gaji', Request::get('no_gaji'))->get(); if ($profiles->isEmpty()) { Session::flash('error', 'Gagal. No Gaji * ' . Request::get('no_gaji') . ' * tidak berdaftar sebagai ahli KOMADA.'); return Redirect::route('members.index'); } $yurans = Yuran::where('no_gaji', Request::get('no_gaji'))->where('bulan_tahun', 'like', '%' . Carbon::now()->format('Y'))->orderBy('bulan_tahun', 'asc')->get(); $yuranTambahan = []; for ($i = 1; $i <= 12; $i++) { if ($i < 10) { $bulan = '0' . $i; } else { $bulan = $i; } $yuranTambahans = Yurantambahan::where('created_at', 'like', Carbon::now()->format('Y') . '-' . $bulan . '%')->orderBy('created_at', 'asc')->get(); if ($yuranTambahans->isEmpty()) { $yuranTambahan = 0.0; } else { foreach ($yuranTambahans as $tambahan) { array_push($yuranTambahan, ['bulan' => $bulan, 'no_gaji' => $tambahan->no_gaji, 'nama' => $tambahan->profileName($tambahan->no_gaji), 'catatan' => $tambahan->sumbangan->nama, 'penerima' => $tambahan->penerima, 'tarikh' => $tambahan->tarikh, 'jumlah' => $tambahan->jumlah]); } } if ($i == Carbon::now()->format('m')) { $i = 13; } } $bil = 1; $biasas = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->get(); return View('members.profile', compact('bil', 'profiles', 'yurans', 'yuranTambahan', 'biasas')); }
public function update() { $profile = Profile::where('user_id', Auth::user()->id)->first(); $profile->fill(Input::all()); $profile->save(); return Redirect::to("/edit_profile"); }
/** * Returns a JSON response of a requested user. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $user = \App\User::where(['name' => $request['name']])->get(); $id = $user[0]['id']; $articles = \App\Article::where(['user_id' => $id])->get(); $profile = \App\Profile::where(['user_id' => $id])->get()->first(); return response()->json(['error' => false, 'user' => $user, 'articles' => $articles, 'profile' => $profile]); }
public function settingupdate($id, Request $request) { $accout = DB::table('users')->find($id); $user = new Profile(); $data = array('Address' => $request->input('Address'), 'Contact' => $request->input('Contact'), 'Graduation_Date' => $request->input('Graduation_Date'), 'Comments' => $request->input('Comments'), 'Email' => $request->input('Email')); $user->where('id', $accout->profile_id)->update($data); return Redirect('/'); }
public function pwtPost() { $found = false; $info = []; $akaunPotongan = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('status', 1)->where('perkhidmatan_id', Request::get('perkhidmatan_id'))->get(); $info = []; $kelayakan = true; if (!$akaunPotongan->isEmpty()) { // This is true for PWT // False for repeatative perkhidmatan id $akaun = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('status', 1)->where('perkhidmatan_id', Request::get('perkhidmatan_id'))->first(); $baki = $akaun->baki; // Formula tempoh = ceiling(baki / bulanan) $bakiTempoh = ceil(number_format($akaun->baki / $akaun->bulanan, 2)); // LANGSAI // Formula :- // Langsai = (baki - lebihan kadar) + 6 bulan kadar // Lebihankadar = baki tempoh * kadar sebulan; $kadarSebulan = $akaun->jumlah * ($akaun->kadar / 100) / 12; $lebihanKadar = $bakiTempoh * $kadarSebulan; $langsai = $baki - $lebihanKadar + $kadarSebulan * 6; // LAYAK // Formula :- // layak = ??? $layak = $this->getJumlahLayak(Request::get('no_gaji')); $info = [$baki, $bakiTempoh, $langsai, $layak]; if ($layak < $langsai) { $kelayakan = false; } $found = true; } //########################################################################################### // check if the no_gaji one of ahli komada $profile = Profile::where('no_gaji', Request::get('no_gaji'))->get(); if ($profile->isEmpty()) { Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tidak didaftarkan sebagai anggota KOMADA.'); return Redirect::back()->withInput(); } // check wether if the no_gaji active or inactive $profile = Profile::where('no_gaji', Request::get('no_gaji'))->where('status', 0)->get(); // dd('here'); //########################################################################################### if (!$profile->isEmpty()) { Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tidak aktif.'); return Redirect::back()->withInput(); } // this to pass profile attribute to the view. $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first(); $yuranTerkumpul = $this->getYuranTerkumpul(Request::get('no_gaji')); $layakPinjam = $this->getJumlahLayak(Request::get('no_gaji')); $pertaruhan = $this->getJumlahPertaruhan(Request::get('no_gaji')); if ($yuranTerkumpul <= 0) { Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . ' mempunyai yuran terkumpul RM 0.00. Tidak Layak membuat pinjaman.'); return Redirect::back()->withInput(); } Session::put('no_gaji', Request::get('no_gaji')); return View('members.calculator.pwt_calculator', compact('profile', 'akaunPotongan', 'found', 'info', 'akaun', 'kelayakan', 'layakPinjam', 'pertaruhan', 'yuranTerkumpul')); }
public function showProfileToUser() { $profile = Profile::where('user_id', Auth::id())->first(); if (!$profile) { return Redirect::route('profile.create'); } $user = Auth::user(); return view('profile.show', compact('profile', 'user')); }
/** * @param $id * @return mixed */ public function userValidation($id) { Profile::where('user_id', $id)->update(['certified' => 1]); $user = User::find($id); Mail::send('auth.validated', [], function ($m) use($user) { $m->to($user['email'], $user['name'])->subject('Tu cuenta ha sido validada'); }); return '<h1>El usuario sera notificado sobre la validación de su cuenta.</h1>'; }
public function indexPost() { $profiles = Profile::where('no_gaji', Request::get('no_gaji'))->get(); if ($profiles->isEmpty()) { Session::flash('error', 'Gagal. No Gaji * ' . Request::get('no_gaji') . ' * tidak berdaftar sebagai ahli KOMADA.'); return Redirect::back()->withInput(); } return Request::all(); }
protected function getZonGaji($no_gaji) { $profile = Profile::where('no_gaji', $no_gaji)->first(); if ($profile != null) { return $profile->zon_gaji_id; } else { return ''; } }
public function daftarPost() { if (Request::get('jumlah_pertaruhan') != "0.00") { $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first(); $profile->jumlah_pertaruhan = Request::get('jumlah_pertaruhan'); $profile->save(); Session::flash('success', 'Berjaya, Wang Pertaruhan berjaya didaftarkan.'); } return Redirect::route('members.pertaruhan.index'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getUserProfile() { $user = Auth::user(); $items = Item::all(); $profileList = Profile::where('user_id', '=', 1)->lists('characterName', 'id'); // $request = /* where (useSkills = profile_id) // return [item_id => [tier_id], item_id => [tier_id]] */ $itemList = useSkill::where('profile_id', '=', 1)->join('items', 'items.id', '=', 'item_id')->join('tiers', 'tiers.id', '=', 'tier_id')->groupBy('items.name')->get(['items.name', 'tiers.tier']); return view('profile.profile', compact('items', 'profileList', 'itemList')); }
public function indexPost() { $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first(); if (empty($profile)) { Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tidak didaftarkan sebagai anggota KOMADA.'); return Redirect::back()->withInput(); } // 1. check for outstanding payment for buku sekolah // 2. return View('members.bukusekolah.form', compact('profile')); }
/** * Test profile update logic * * @return void */ public function testEditProfile() { // Mock the process empty profile is created upon creating new user $user = factory(App\User::class)->create(); $profile = factory(App\Profile::class)->create(['user_id' => $user->id]); $this->actingAs($user)->json('POST', '/profile/edit', ['firstName' => 'first name', 'lastName' => 'last name', 'country' => 'canada', 'city' => 'toronto'], ['HTTP_X-Requested-With' => 'XMLHttpRequest'])->seeJson(['status' => 'ok']); $updated = Profile::where('user_id', $user->id)->first(); $this->assertEquals('first name', $updated->firstName); $this->assertEquals('last name', $updated->lastName); $this->assertEquals('canada', $updated->country); $this->assertEquals('toronto', $updated->city); }
public function indexPost() { $accounts = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->get(); if ($accounts->isEmpty()) { Session::flash('error', 'Gagal. No gaji *' . Request::get('no_gaji') . '* tiada sebarang pinjaman'); return Redirect::back(); } $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first(); $nama = $profile->nama; $no_gaji = Request::get('no_gaji'); return View('members.tangguh.form', compact('accounts', 'nama', 'no_gaji')); }
/** * Display a user's profile page. * * @return \Illuminate\Http\Response */ public function index($idNum) { $user = \App\User::where(['id' => $idNum])->get()->first(); $prof = \App\Profile::where(['user_id' => $idNum])->get()->last(); $auth = \Auth::user()->id; $authProf = \App\Profile::where(['user_id' => $auth])->get()->last(); $articles = Article::where(['user_id' => $idNum])->latest()->simplePaginate(6); $url = 'http://www.gravatar.com/avatar/'; $url .= md5(strtolower(trim($user['email']))); $url .= "?s=80&d=mm&r=g"; return view('profiles/index', compact('user', 'url', 'prof', 'articles', 'auth', 'authProf')); }
public function showProfileToUser() { $currentUser = Auth::id(); $profile = Profile::where('user_id', '=', $currentUser)->first(); if (!$profile) { return Redirect::route('profile.create'); } $user = User::where('id', '=', $profile->user_id)->first(); if ($this->userNotOwnerOf($profile)) { throw new UnauthorizedException(); } return view('profile.show', compact('profile', 'user')); }
public function showPostProject($post, $id) { $post = Post::findOrFail($id); $post->views = ++$post->views; $post->save(); $profiles = Profile::where('category_id', $post->category_id)->take(5)->get(); $prev = Post::where('category_id', $post->category_id)->where('status', 1)->where('id', '>', $post->id)->select('id', 'slug')->first(); $next = Post::where('category_id', $post->category_id)->where('status', 1)->orderBy('id', 'DESC')->where('id', '<', $post->id)->select('id', 'slug')->first(); $images = $post->images ? unserialize($post->images) : null; $contacts = json_decode($post->phone); $first_number = rand(1, 10); $second_number = rand(1, 10); return view('tender.post', compact('post', 'profiles', 'prev', 'next', 'images', 'contacts', 'first_number', 'second_number')); }
public function search(Request $request) { $search_query = trim($request->input('search_query')); $queries = explode(' ', $search_query); if ($queries[0] == "all" && $queries[1] == "users") { } $profiles = \App\Profile::where(function ($query) use($queries) { $query = $query->orWhere('name', $queries[0]); $query = $query->orWhere('surname', $queries[0]); if (count($queries) > 1) { $query = $query->orWhere('name', $queries[1]); $query = $query->orWhere('surname', $queries[1]); } })->get(); return view('search_results', ['results' => $profiles]); }
public function create() { $user = Auth::user(); // try to find the profile id that matches the user profile try { $profile = Profile::where('user_id', $user->id)->firstOrFail(); } catch (ModelNotFoundException $e) { // if it fails create profile $profile = new Profile(); $profile->user_id = $user->id; $profile->save(); flash()->overlay('Welcome to Baking Amigo!', 'Now tell us a bit about yourself.', 'info'); } // redirect to the edit page return redirect("/users/{$user->id}/edit"); }
/** * Create a new controller instance. * * @return void */ public function __construct(LaravelFacebookSdk $fb, Menu $menu, UserRepository $userrepo, ProjectRepository $project_repo) { $this->middleware('auth'); $this->menuItems = $menu->where('active', '1')->orderBy('weight', 'asc')->get(); $this->login_url = $fb->getLoginUrl(['email']); $this->userrepo = $userrepo; $this->project_repo = $project_repo; $id = Auth::user()->id; $userProfile = Profile::where('user_id', $id)->first(); $errorNotification = '0'; //if(($userProfile->f_name=='') || ($userProfile->l_name=='') || ($userProfile->dob=='0000-00-00') || ($userProfile->about_me=='') || ($userProfile->first_address=='') || ($userProfile->alternate_address=='') || ($userProfile->state=='') || ($userProfile->zipcode=='') || ($userProfile->user_avtar=='')) //{ //$errorNotification='1'; //} $this->errorNotification = $errorNotification; }
public function uploadTn($fileName, $image) { $path = public_path('/images/' . Auth::user()->name); File::exists($path) or File::makeDirectory($path, 0755, true); $image->save($path . '/' . $fileName)->resize(128, 128)->save($path . '/' . 'pp.jpg'); if (Auth::user()->profile == null) { $picture = new Profile(); $picture->user_id = Auth::user()->id; $picture->thumbnailName = 'images/' . Auth::user()->name . '/pp.jpg'; $picture->save(); } else { $picture = Profile::where('user_id', Auth::user()->id)->first(); $picture->user_id = Auth::user()->id; $picture->thumbnailName = 'images/' . Auth::user()->name . '/pp.jpg'; $picture->save(); } }
/** * Show logged in user's profile. * * @return mixed */ public function index() { $user_id = Auth::user()->id; $profile = Profile::where('user_id', '=', $user_id)->first(); $nulls = 0; $no_val_html = '<a href="#myProfileModal" data-toggle="modal" role="button"><span class="glyphicon glyphicon-question-sign text-danger"></span></a>'; if ($profile['attributes']) { $prof_attrs = count($profile['attributes']) - 4; foreach ($profile['attributes'] as $attr) { if ($attr == null) { $nulls += 1; } } $nulls = number_format(($prof_attrs - $nulls) / $prof_attrs * 100, 0); } return view('profile.show', ['profile' => $profile, 'nulls' => $nulls, 'no_val' => $no_val_html]); }
public function index() { $accounts = AkaunPotongan::where('status', 1)->get(); $profiles = []; if ($accounts->isEmpty()) { return View('members.index', compact('profiles')); } foreach ($accounts as $account) { if ($account->baki <= $account->bulanan * 3) { $profile = Profile::where('no_gaji', $account->no_gaji)->first(); if ($profile != null) { array_push($profiles, ['nama' => $profile->nama, 'no_gaji' => $account->no_gaji, 'baki' => $account->baki, 'bulanan' => $account->bulanan]); } } } return View('members.index', compact('profiles')); }
public function postAboutMe(Request $request) { $rules = ['about_me' => 'required|min:3']; $this->validate($request, $rules); $profile = Profile::where('user_id', Auth::user()->id)->first(); // the users profile was never set. if (empty($profile->about_me)) { $profile->about_me = $request->input('about_me'); $profile->save(); Session::flash('flash_message', 'Your About me text is saved'); return redirect('/profile'); } else { $profile->about_me = $request->input('about_me'); $profile->save(); Session::flash('flash_message', 'Your About me text is updated'); return redirect('/profile')->with('profile', $profile); } }
public function postSubmitVote(Request $request) { return redirect()->action('HomeController@getGameOver'); if (!Auth::id()) { return response()->json(['message' => 'user not found'], 400); } $profile = Profile::where('id', '=', $request->input('profileId'))->first(); if (!$profile || $profile->isActive != 1) { return response()->json(['message' => 'profile not found'], 400); } $vote = Vote::where(['user_id' => Auth::id(), 'profile_id' => $request->input('profileId')])->first(); if (!$vote || $vote->isActive == 1) { return response()->json(['message' => 'cannot change vote'], 400); } $vote->isActive = 1; $vote->save(); return response()->json(['message' => 'validEntry'], 201); }
public function getProfile($id = Null) { if ($id == Null) { \App::abort(404, 'Invalid User Id'); } else { $user_id = $id; } $user = \App\User::where('id', $user_id)->first(); $userProfile = Profile::where('user_id', $user_id)->first(); $lists = ProjectFund::where('U_ID', $user_id)->whereIn('status', ['Pledged', 'Funded'])->orderBy('created_at', 'desc')->get(); if (count($lists) > 0) { foreach ($lists as $val) { $fundedProjectLists[] = $val->P_ID; } } $result = array_unique($fundedProjectLists); $myFundedProjectLists = Project::where('active', '1')->whereIn('id', $result)->orderBy('created_at', 'desc')->get(); $getResults = $this->project_repo->prepareListObj($myFundedProjectLists); return view('user.user-profile', ['_menus' => $this->menuItems, 'login_url' => $this->login_url, 'user' => $user, 'userProfile' => $userProfile, 'dashBoardDetailsByAuthUser' => $this->userrepo->generalOverViewByAuthUser($user_id), 'my_funded_projects' => $getResults]); }
public function langsaiPost() { $profile = Profile::where('no_gaji', Request::get('no_gaji'))->get(); if ($profile->isEmpty()) { Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tidak berdafatar dengan KOMADA'); return Redirect::back(); } $profile = Profile::where('no_gaji', Request::get('no_gaji'))->first(); $akauns = AkaunPotongan::where('no_gaji', Request::get('no_gaji'))->where('status', 1)->get(); if ($akauns->isEmpty()) { Session::flash('error', 'Gagal. No Gaji *' . Request::get('no_gaji') . '* tiada rekod pinjaman/tertunggak'); return Redirect::back(); } $accounts = []; foreach ($akauns as $akaun) { $perkhidmatan = Perkhidmatan::where('id', $akaun->perkhidmatan_id)->first(); // $baki = $akaun->baki; $baki = $this->getJumlahLangsai($akaun->id); array_push($accounts, ['id' => $akaun->perkhidmatan_id, 'nama' => $perkhidmatan->nama, 'baki' => $baki]); } return View('members.bayaran.langsaiPost', compact('profile', 'accounts')); }