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('/'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(ProfileCreateRequest $request) { $profile = new Profile(['nombre' => $request['nombre'], 'apP' => $request['apP'], 'apM' => $request['apM'], 'telefono' => $request['telefono'], 'fechaNac' => $request['telefono'], 'user_id' => $request['id']]); $profile->save(); $user = User::find($request['id']); Session::flash('message', 'Datos ingresados Correctamente'); return view('profileUsr.profile', compact('user', 'profile')); }
public function createDefaultUserProfile(User $new_user) { $profile = new Profile(); $profile->user_id = $new_user->id; $profile->about_me = ''; $profile->profile_image_name = UserController::getDefaultImageName(); $profile->save(); }
public function getInsert() { //インスタンス生成 $profile = new Profile(); $profile->name = "fujimon"; $profile->age = 23; $profile->detail = "ikemen"; //保存 $profile->save(); }
public function confirm($token) { $confirm = ConfirmUser::where('token', $token)->firstOrFail(); $user = User::where('email', $confirm->email)->first(); $user->attachRole(3); $user->status = 1; $user->save(); $profile = new Profile(); $profile->user_id = $user->id; $profile->city_id = $confirm->city_id; $profile->save(); $confirm->delete(); return redirect('auth/login')->with('status', 'Вы успешно потдвердили регистрацию. Теперь войдите в систему используя свой email и пароль.'); }
public function confirm($token) { $confirm = ConfirmUser::where('token', $token)->firstOrFail(); $user = User::where('email', $confirm->email)->first(); $user->attachRole(3); $user->status = 1; $user->save(); $profile = new Profile(); $profile->user_id = $user->id; $profile->city_id = $confirm->city_id; $contacts = ['phone' => null, 'telegram' => null, 'whatsapp' => null, 'viber' => null, 'phone2' => null, 'telegram2' => null, 'whatsapp2' => null, 'viber2' => null]; $profile->phone = json_encode($contacts); $profile->save(); $confirm->delete(); return redirect('auth/login')->with('status', 'Вы успешно потдвердили регистрацию. Теперь войдите в систему используя свой email и пароль.'); }
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"); }
public function getProfile(Request $request) { $id = $request->input('id'); $profile = Profile::find($id); $profile->delete(); return response()->json(['status' => 'valid']); }
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); } }
/** * @return mixed */ private function getCompletedProfiles($limit = null) { $profiles = Profile::completed()->get()->filter(function ($profile) { return $profile->hasProfilePic(); }); return !is_null($limit) && $profiles->count() > $limit ? $profiles->random($limit) : $profiles; }
/** * 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'); }
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 run() { \App\Profile::create(array('userid' => 1, 'about' => 'anurdha is great')); \App\Profile::create(array('userid' => 2, 'about' => 'yeah is great')); \App\Profile::create(array('userid' => 3, 'about' => 'ret is weak')); \App\Profile::create(array('userid' => 4, 'about' => 'pep is beek')); }
public function index(Request $request) { $miss = Profile::online()->miss()->orderByVotes()->get(); $mister = Profile::online()->mister()->orderByVotes()->get(); $profiles = ['miss' => $miss, 'mister' => $mister]; return view('guest.home')->with('profiles', $profiles); }
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')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CreateUserRequest $request, User $user, Profile $profile) { $user->create(['username' => $request->get('username'), 'password' => bcrypt($request->get('password')), 'role' => $request->get('role')])->save(); $profile->create(['username' => $request->get('username'), 'name' => $request->get('name'), 'email' => $request->get('email')])->save(); flash()->info('Created a New User !!'); return redirect()->route('admin.all'); }
/** * Create a new user and connected profile 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'])]); $profile = Profile::create(['user_id' => $user->id, 'picture' => "default-avatar.jpg"]); $user->profile()->save($profile); return $user; }
/** * Run the Profiles table seeds. * * @return void */ public function run() { Eloquent::unguard(); Profile::create(['id' => 1, 'user_id' => 1, 'bio' => 'I like to soccer, women, and beer.', 'location' => 'Long Beach, CA', 'twitter_username' => 'johnsfeed', 'instagram_username' => 'johnwashere']); Profile::create(['id' => 2, 'user_id' => 2, 'bio' => 'I like to cooking, reading, and swimming.', 'location' => 'Oceanside, CA', 'twitter_username' => 'karenwho', 'instagram_username' => 'karenthequeen']); Profile::create(['id' => 3, 'user_id' => 3, 'bio' => 'I like eating raw food and yoga.', 'location' => 'San Francisco, CA', 'twitter_username' => 'janesworld', 'instagram_username' => 'janedidit']); }
public function get($userId) { // $profiles = Profile::find($userId); $profiles = Profile::where('userId', $userId)->first(); return $profiles; // return array('name' => 'Sheldon Nofer'); }
/** * Run the database seeds. * * @return void */ public function run() { ProfileCategory::create(['id' => 1, 'nama' => 'AHLI BIASA', 'catatan' => '']); ProfileCategory::create(['id' => 2, 'nama' => 'PPK', 'catatan' => '']); ProfileCategory::create(['id' => 3, 'nama' => 'YPPPM', 'catatan' => 'Y']); ProfileCategory::create(['id' => 4, 'nama' => 'SPPM', 'catatan' => 'S']); ProfileCategory::create(['id' => 5, 'nama' => 'KOMADA', 'catatan' => '']); ProfileCategory::create(['id' => 6, 'nama' => 'PELADANG MART', 'catatan' => 'PM']); $profiles = Profile::all(); foreach ($profiles as $profile) { $no_anggota = (int) $profile->no_anggota; if ($no_anggota != 0) { $profile->profile_category_id = 1; $profile->save(); } if (strpos($profile->no_anggota, 'Y') !== false) { $profile->profile_category_id = 3; $profile->save(); } if (strpos($profile->no_anggota, 'S') !== false) { $profile->profile_category_id = 4; $profile->save(); } if (strpos($profile->no_anggota, 'PM') !== false) { $profile->profile_category_id = 6; $profile->save(); } if (strpos($profile->no_anggota, 'A') !== false || strpos($profile->no_anggota, 'B') !== false || strpos($profile->no_anggota, 'C') !== false || strpos($profile->no_anggota, 'F') !== false) { $profile->profile_category_id = 2; $profile->save(); } } }
/** * 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(), // ]); // } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = \Faker\Factory::create(); foreach (range(1, 10) as $index) { $user = User::All()->random(1); Profile::create(['user_id' => $user->id, 'telephone' => $faker->phoneNumber, 'telegram' => $faker->username]); } }
public function getApproveProfile($profileId) { $profile = Profile::find($profileId); $profile->checked = 1; $profile->isActive = 1; $profile->save(); return redirect('admin/index'); }
public function about() { $data = Profile::find(auth()->user()->get('account_id')); /** TODO: Довърши страницата about */ return view('pages.profile.about')->with('data', $data); }
/** * 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]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $profiles = Profile::with('playlists')->where('user_id', 1)->first(); $playlist = $profiles->playlists->filter(function ($playlist) use($id) { return (int) $playlist->id === (int) $id; })->first(); return response()->json(['playlist' => $playlist]); }
public function run() { $faker = Faker\Factory::create(); Profile::truncate(); foreach (range(1, 20) as $index) { Profile::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'job' => $faker->word, 'motto' => $faker->sentence, 'about' => $faker->paragraph(4), 'favorite' => $faker->paragraph(4), 'favorite_img' => $faker->imageUrl(300, 200), 'sample_img1' => $faker->imageUrl(300, 200), 'sample_img2' => $faker->imageUrl(300, 200), 'sample_img3' => $faker->imageUrl(300, 200), 'location' => $faker->country, 'phone' => $faker->phoneNumber]); } }
/** * 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 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')); }
/** * @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>'; }