public function handleFbCallback() { $fb_user = Socialite::driver('facebook')->user(); $user = User::firstOrCreate(['firstname' => $fb_user->user['first_name'], 'lastname' => $fb_user->user['last_name'], 'email' => $fb_user->email]); Auth::login($user, true); return Redirect::to('/books'); }
public function pmReportTag($id) { $report = PmReport::find($id); $report->tag = 1; $report->save(); return Redirect::to('/pm')->with('message', 'Report Taged!'); }
public function restore($id) { $specificUser = User::withTrashed()->find($id); $specificUser->restore(); $users = User::where('admin1_user0', '=', 0)->withTrashed()->get(); return Redirect::to('dashboard')->with('users', $users); }
public function emptyLogs() { ActionLog::truncate(); $message['result'] = 1; $message['content'] = $message['result'] ? '清空日志成功' : '清空日志失败'; return Redirect::to('admin/actionLogs/')->with('message', $message); }
/** * Handle an incoming request, check to see if we have a redirect in place for the requested URL * and then redirect if we do have a match * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // Get the full URL that has been requested, minus the protocol $full_url = str_replace($request->getScheme() . "://", "", $request->url()); // Check for any results matching the full domain request $results = Redirect::where("type", "domain")->where("from", $full_url)->where("status", "active"); if ($results->exists()) { // Get the first result back $redirect = $results->first(); // Grab the URL before we increment $url = $redirect->to; // Increment the hit count $redirect->increment('hits'); // Redirect off to where we're going return RedirectFacade::to($url); } // Check for any results matching the path only $results = Redirect::where("type", "path")->where("from", "/" . $request->path())->where("status", "active"); // If a redirect exists for this, process it and redirect if ($results->exists()) { // Get the first result back $redirect = $results->first(); // Grab the URL before we increment $url = $redirect->to; // Increment the hit count $redirect->increment('hits'); // Redirect off to where we're going return RedirectFacade::to($url, 301); } // By default, continue afterwards and bail out return $next($request); }
function videoSil($videoSil) { $videoSil = DB::delete("delete from videolar where id = ?", array($videoSil)); if ($videoSil > 0) { return Redirect::to('admin/video'); } }
public function destroy($id) { $role = $this->model->findOrFail($id); $role->delete(); flash()->success(trans('LaravelAdmin::laravel-admin.rolDeleteSuccess')); return Redirect::to('backend/roles'); }
public function store() { // getting all of the post data $file = array('image' => Input::file('image')); $input = Request::all(); $image = $input['image']; // setting up rules $rules = array('image' => 'required'); //mimes:jpeg,bmp,png and for max size max:10000 // doing the validation, passing post data, rules and the messages $validator = Validator::make($image, $rules); if ($validator->fails()) { // send back to the page with the input data and errors return Redirect::to('/')->withInput()->withErrors($validator); } else { // checking file is valid. if (Input::file('image')->isValid()) { $destinationPath = '/uploads/images'; // upload path $extension = Input::file('image')->getClientOriginalExtension(); // getting image extension $fileName = rand(11111, 99999) . '.' . $extension; // renameing image Input::file('image')->move($destinationPath, $fileName); // uploading file to given path // sending back with message Session::flash('success', 'Upload successfully'); return Redirect::to('upload'); } else { // sending back with error message. Session::flash('error', 'uploaded file is not valid'); return Redirect::to('upload'); } } }
public function doLogout() { Auth::logout(); // log the user out of our application return Redirect::to('/'); // redirect the user to the login screen }
/** * Payments */ public function checkout() { $ids = session('likes', []); $total = 0; foreach ($ids as $id) { $movie = Movies::find($id); $total = $total + $movie->price; } $payer = PayPal::Payer(); $payer->setPaymentMethod('paypal'); $amount = PayPal::Amount(); $amount->setCurrency('EUR'); $amount->setTotal($total); $transaction = PayPal::Transaction(); $transaction->setAmount($amount); $transaction->setDescription("Récapitulatif total des " . count($ids) . " films commandés"); $redirectUrls = PayPal::RedirectUrls(); $redirectUrls->setReturnUrl(route('cart_done')); $redirectUrls->setCancelUrl(route('cart_cancel')); $payment = PayPal::Payment(); $payment->setIntent('sale'); $payment->setPayer($payer); $payment->setRedirectUrls($redirectUrls); $payment->setTransactions(array($transaction)); //response de Paypal $response = $payment->create($this->_apiContext); $redirectUrl = $response->links[1]->href; //redirect to Plateform Paypal return Redirect::to($redirectUrl); }
public function postCreate() { $validator = Validator::make(Input::all(), ProductImage::$rules); if ($validator->passes()) { $images = Input::file('images'); $file_count = count($images); $uploadcount = 0; foreach ($images as $image) { if ($image) { $product_image = new ProductImage(); $product_image->product_id = Input::get('product_id'); $product_image->title = $image->getClientOriginalName(); $filename = date('Y-m-d-H:i:s') . "-" . $product_image->title; $path = public_path('img/products/' . $filename); $path_thumb = public_path('img/products/thumb/' . $filename); Image::make($image->getRealPath())->resize(640, 480)->save($path); Image::make($image->getRealPath())->resize(177, 177)->save($path_thumb); $product_image->url = $filename; $product_image->save(); $uploadcount++; } } if ($uploadcount == $file_count) { return Redirect::back(); } else { return Redirect::back()->with('message', 'Ошибка загрузки фотографии'); } } return Redirect::to('admin/products/index')->with('message', 'Ошибка сохранения')->withErrors($validator)->withInput(); }
public function store(OrderRequest $request) { $order = $request->all(); $order['user_id'] = Auth::id(); Order::create($order); return Redirect::to("/?timer=true"); }
public function delete($id) { $song = Song::find($id); $song->delete(); Session()->flash('deletesong', 'Song is Deleted'); return Redirect::to('song'); }
public function reset_pwd(Request $request) { $update_pwd = User::find(\Auth::user()->id); $update_pwd->password = $request->input('password'); $update_pwd->save(); return Redirect::to('facebook_welcome')->with('message', 'Password updated successfully!'); }
function getAttendance($member = '') { $input = Input::all(); if ($member == null or $member == '') { $memberId = Session::get('memberId'); } else { $memberId = $member; } if (array_key_exists('date', $input)) { $year = date("Y", strtotime($input['date'])); $startDate = $year . '-01-01'; $endDate = $startDate . '12-31'; } else { $year = date("Y"); $startDate = $year . '-01-01'; $endDate = $year . '-12-31'; } $month = array_key_exists('month', $input) ? $input['month'] : date('F'); $month = Month::ForMonth($month)->first(); if (!empty($month)) { $attendance = $month->attendances()->DateBetween($startDate, $endDate)->ForMember($memberId)->get(); $attendances = $this->AverageMonthAttendance($attendance, $month, $year); return $attendances; } else { return Redirect::to('/auth/dashboard')->withFlashMessage('No Attendnce for the month'); } }
/** * loginWithFacebook * * @param Request $request * @return Response */ public function loginWithFacebook(Request $request) { // get data from request $code = $request->get('code'); // get fb service $fb = \OAuth::consumer('Facebook'); // check if code is valid // if code is provided get user data and sign in if (!is_null($code)) { // This was a callback request from facebook, get the token $token = $fb->requestAccessToken($code); // Send a request with it $result = json_decode($fb->request('/me'), true); $user = User::where('email', '=', $result['email'])->first(); if (empty($user)) { $user = new User(); $user->name = $result['name']; $user->email = $result['email']; $user->password = bcrypt($result['email']); $user->save(); } Auth::login($user); if (Auth::check()) { return Redirect::to('/'); } else { echo 'login fail'; } } else { // get fb authorization $url = $fb->getAuthorizationUri(); // return to facebook login url return redirect((string) $url); } }
public function getDelete($id) { $accountNames = NameOfAccount::find($id); $accountNames->delete(); Session::flash('message', 'Account Name has been Successfully Deleted.'); return Redirect::to('accountnames/index'); }
public function getLogout() { if (Auth::check()) { Auth::logout(); } return Redirect::to('index')->with('message', '你现在已经退出登录了!'); }
public function logout() { $seguranca = new DPRFSeguranca(config("PRF.siglaSistema"), config("PRF.producao")); $seguranca->auditoria(Auth::user()->cpf, "LOGOUT", "Logout", array()); Auth::logout(); return Redirect::to("/"); }
public function markNotificationsRead() { $user = Auth::user(); $user->readAllNotifications(); // return Json::encode(array('success' => true, 'message' => 'All notifications marked read')); return Redirect::to('/dashboard')->with('success_message', 'All notifications marked as read'); }
public function TambahJadwal() { $rules = array('unit_id' => 'required', 'kategori' => 'required', 'tglstart' => 'required', 'tglases' => 'required', 'tglfinish' => 'required', 'detail' => 'required'); $messages = array('unit_id.required' => 'Nama Jabatan Harus Terisi', 'kategori.required' => 'Kategori Harus Dipilih', 'tglstart.required' => 'Tanggal Mulai Harus Terisi', 'tglases.required' => 'Tanggal Asessment Harus Terisi', 'tglfinish.required' => 'Tanggal Selesai Harus Terisi', 'detail.required' => 'Detail Harus terisi'); $validasi = validator::make(Input::all(), $rules, $messages); if ($validasi->fails()) { return Redirect::back()->withErrors($validasi)->withInput(); } else { $kat = Input::get('kategori'); if ($kat == 'internal') { $aa = "in"; } else { $aa = "ex"; } DB::transaction(function ($aa) use($aa) { //asesment promosi $jadwal = KandidatPromote::create(['unit_staf_id' => Input::get('unit_id'), 'tgl_awal' => Input::get('tglstart'), 'tgl_asesment' => Input::get('tglases'), 'tgl_selesai' => Input::get('tglfinish'), 'detail' => Input::get('detail')]); //rekrutmen rekap header $rekap_header = HeaderRekap::create(['id_asesmen' => $jadwal->id, 'kategori' => Input::get('kategori'), 'nama' => Input::get('jabatan'), 'tanggal_awal' => Input::get('tglstart'), 'tanggal_akhir' => Input::get('tglfinish'), 'deksripsi' => Input::get('detail')]); //asessment promosi daftar $daftar = KandidatPromosiDaftar::create(['asesment_promosi_id' => $jadwal->id, 'nip' => Input::get('nip'), 'detail' => Input::get('detail')]); //rekrutment rekap profiling $profil = ProfilingRekap::create(['id_rekap' => $rekap_header->id, 'kategori' => $aa, 'nip' => $daftar->nip, 'id_jabatan' => $jadwal->unit_staf_id]); }); Session::flash('message', 'Berhasil Menambahkan Jadwal Asessment'); return Redirect::to('career/jadwal/lihat/asessment'); } }
public function start() { if (Auth::check()) { return \View::make('dashboard')->with('name', 'ritesh'); } return Redirect::to('auth/login'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle(\Illuminate\Http\Request $request, Closure $next) { if (Auth::user()->cannot('isSuperAdmin', Auth::user())) { return Redirect::to('auth/login')->with('danger', "Vous n'etes pas authoriser a acéder à cette partie :("); } return $next($request); }
/** * Run the app is setup middleware. * * We're verifying that Cachet is correctly setup. If it is, then we're * redirecting the user to the dashboard so they can use Cachet. * * @param \Illuminate\Routing\Route $route * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if (Setting::get('app_name')) { return Redirect::to('dashboard'); } return $next($request); }
function post() { $att = Attachment::find(Request::route('id3')); $pageId = Request::route('id1'); $att->delete(); return Redirect::to("/admin/manage-pages/{$pageId}/content"); }
public function mailGonder() { Mail::send('emails.welcome', ['key' => 'value'], function ($message) { $message->to('*****@*****.**', 'John Smith')->subject('Welcome!'); }); return Redirect::to("uyeler"); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('first_name', 'last_name', 'email', 'password'); $command = new CreateNewUserCommand($input['email'], $input['first_name'], $input['last_name'], $input['password']); $this->commandBus->execute($command); return Redirect::to('/profile'); }
public function createRoom(Request $request) { $createGame = Game::prepareCreateGame(Input::all()); $gameCreated = Game::create($createGame); $gameCreated->attachPlayersToGame(); return Redirect::to('gameLobby'); }
public function update() { $profile = Profile::where('user_id', Auth::user()->id)->first(); $profile->fill(Input::all()); $profile->save(); return Redirect::to("/edit_profile"); }
function haberSil($habersil) { $habersil = DB::delete("delete from haberler where id = ?", array($habersil)); if ($habersil > 0) { return Redirect::to('admin/haberler'); } }