當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::flashOnly方法代碼示例

本文整理匯總了PHP中Illuminate\Http\Request::flashOnly方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::flashOnly方法的具體用法?PHP Request::flashOnly怎麽用?PHP Request::flashOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Http\Request的用法示例。


在下文中一共展示了Request::flashOnly方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 /**
  * Display the specified resource.
  *
  * @param  Request $request
  * @return \Illuminate\Http\Response
  */
 public function search(Request $request)
 {
     $query = DB::table('teachers')->join('users', 'teachers.id', '=', 'users.id')->join('teacher_topic', 'teacher_topic.teacher_id', '=', 'teachers.id')->join('topics', 'topics.id', '=', 'teacher_topic.topic_id')->join('subjects', 'subjects.id', '=', 'topics.subject_id')->join('grades', 'grades.id', '=', 'subjects.grade_id')->join('qualifications', 'qualifications.teacher_id', '=', 'teachers.id')->select('users.id', 'users.name', 'users.picture', 'users.gender', 'qualifications.college', 'qualifications.degree', 'users.introduction', 'teachers.rating', 'teachers.rating_count', 'teachers.minfees')->where('teachers.display', '=', 1);
     if ($request->search !== null && $request->search !== '') {
         $query->where('users.name', 'LIKE', '%' . $request->search . '%')->orWhere('topics.name', 'LIKE', '%' . $request->search . '%')->orWhere('subjects.name', 'LIKE', '%' . $request->search . '%')->orWhere('grades.name', 'LIKE', '%' . $request->search . '%');
     }
     $teachers = $query->distinct()->groupBy('name')->get();
     $results = count($teachers);
     if ($request->search && empty($teachers)) {
         $query = DB::table('teachers')->join('users', 'teachers.id', '=', 'users.id')->join('qualifications', 'qualifications.teacher_id', '=', 'teachers.id')->select('users.id', 'users.name', 'users.picture', 'users.gender', 'qualifications.college', 'qualifications.degree', 'users.introduction', 'teachers.rating', 'teachers.rating_count', 'teachers.minfees')->where('teachers.display', '=', 1);
         $teachers = $query->distinct()->groupBy('name')->get();
     }
     //var_dump($results);
     //var_dump($request->search);
     //echo "<pre>";print_r($teachers);echo "</pre>";
     $request->flashOnly('search');
     $topIds = [76, 272, 230, 128, 52, 38, 181, 43];
     foreach ($teachers as $key => $teacher) {
         if (in_array($teacher->id, $topIds)) {
             unset($teachers[$key]);
             array_unshift($teachers, $teacher);
         }
     }
     //foreach ($teachers as $key => $teacher) { echo $teacher->picture."<br>";	}
     return view('frontend.teachers', ['teachers' => $teachers, 'page' => 'teachers', 'results' => $results]);
 }
開發者ID:GetIITians,項目名稱:getiitians,代碼行數:32,代碼來源:TeacherController.php

示例2: postLogin

 public function postLogin(Request $request)
 {
     $request->flashOnly('email');
     $this->validate($request, ['email' => 'required', 'password' => 'required']);
     $credentials = $request->only('email', 'password');
     if (Auth::attempt($credentials, $request->has('remember'))) {
         return redirect()->intended($this->redirectPath());
     }
     return redirect('/auth/login')->withInput($request->only('email'))->withErrors(['email' => '用戶名或密碼錯誤!']);
 }
開發者ID:hitobias,項目名稱:recovery,代碼行數:10,代碼來源:AuthController.php

示例3: find

 /**
  * Show the form for creating a new resource.
  *
  * @param Request $request
  * @return \Illuminate\Http\Response
  */
 public function find(Request $request)
 {
     $givenname = $request->input('givenname');
     $surname = $request->input('surname');
     $request->flashOnly('givenname', 'surname');
     $holderQuery = Holder::with('animals.medications')->where('givenname', 'LIKE', $givenname)->orWhere('surname', 'LIKE', $surname);
     $holderSql = $holderQuery->toSql();
     $holder = $holderQuery->first();
     return view('home.index', ['holder' => $holder, 'sql' => $holderSql]);
 }
開發者ID:okaufmann,項目名稱:tsbe-db-exercise-animals,代碼行數:16,代碼來源:HomeController.php

示例4: getSearchBarang

 /**
  * Get all daftar barang by divisi
  *
  * @return Response
  * @author Y.Brahmantyo A.K
  **/
 public function getSearchBarang(Request $request)
 {
     $divisi = divisi::all();
     $arrdivisi = [];
     foreach ($divisi as $d) {
         $arrdivisi[$d->iddivisi] = $d->nama;
     }
     $barang = barang::where('namadet', 'like', '%' . $request->input('search') . '%')->paginate(Config::get('pages'));
     $request->flashOnly('search');
     return view('admin.master.barang.index')->with('barang', $barang)->with('arrdivisi', $arrdivisi);
 }
開發者ID:brahmantyo,項目名稱:bias,代碼行數:17,代碼來源:BarangController.php

示例5: getIndex

 /**
  * Get Daftar Stock
  *
  * @return Response
  * @author Y.Brahmantyo A.K
  **/
 public function getIndex(Request $request)
 {
     $stock = stock::selectRaw('sup.nama AS supplier,stock.plu,mb.namadet AS nmbarang,SUM(stock.qtyunitsisa) qtyunit,stu.namasatuan satunit,SUM(stock.qtypjgsisa) qtypjg,stp.namasatuan satpjg,SUM(stock.qtybrtsisa) qtybrt,stb.namasatuan satbrt')->leftJoin('mbarang AS mb', 'mb.plu', '=', 'stock.plu')->leftJoin('msupplier AS sup', 'sup.idsupp', '=', 'mb.idsup')->leftJoin('msatuan AS stu', 'stu.idsatuan', '=', 'mb.satunit')->leftJoin('msatuan AS stp', 'stp.idsatuan', '=', 'mb.satpjg')->leftJoin('msatuan AS stb', 'stb.idsatuan', '=', 'mb.satbrt');
     if (!empty($request->input('p'))) {
         $search = $request->input('p');
         $stock = $stock->where('sup.nama', 'like', '%' . $search . '%')->orWhere('stock.plu', 'like', '%' . $search . '%')->orWhere('mb.namadet', 'like', '%' . $search . '%');
     }
     $stock = $stock->groupBy('stock.plu')->paginate(\Config::get('pages'));
     $request->flashOnly('p');
     return view('admin.report.stock')->with('stock', $stock);
 }
開發者ID:brahmantyo,項目名稱:bias,代碼行數:17,代碼來源:StockController.php

示例6: check

 /**
  * Run the validation check, will call laravels validator.
  *
  * @return boolean
  */
 public function check()
 {
     if ($this->preCheck() === false) {
         return false;
     }
     $this->lastValidator = $this->validation->make($this->getInput(), $this->getRules(), $this->getFailedMessages());
     if ($this->lastValidator->fails()) {
         $this->request->getSessionStore()->flash('errors', $this->lastValidator->getMessageBag());
         $this->request->flashOnly(array_keys($this->selectInput(false)));
         return false;
     }
     return true;
 }
開發者ID:bigelephant,項目名稱:input-validator,代碼行數:18,代碼來源:Validator.php

示例7: flashOnly

 /**
  * Flash only some of the input to the session.
  *
  * @param array|mixed $keys
  * @return void 
  * @static 
  */
 public static function flashOnly($keys)
 {
     \Illuminate\Http\Request::flashOnly($keys);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:11,代碼來源:_ide_helper.php

示例8: login

 /**
  * 登錄
  */
 public function login(Request $request)
 {
     // get option
     if ($request->isMethod('get')) {
         //如果已登錄跳轉到管理首頁
         if ($request->session()->has('admin_id')) {
             session()->flash('msg_success', '請勿重複登錄');
             return redirect('/admin');
         }
         return view('admin.login');
     }
     if (!$request->isMethod('post')) {
         App::abort(404);
     }
     // post option
     $sUsername = trim($request->input('username', null));
     $sPassword = trim($request->input('password', null));
     $validate = $this->login_validator(['username' => $sUsername, 'password' => $sPassword]);
     $temp_admin = Admin::where('username', $sUsername)->select('id')->get();
     $admin_id = isset($temp_admin[0]) ? $temp_admin[0]->id : 0;
     unset($temp_admin);
     if ($validate->fails() || !$admin_id) {
         session()->flash('msg_error', '賬號或密碼錯誤');
         $request->flashOnly('username');
         return back();
     }
     $oAdminLoginLog = new AdminLoginLog();
     $login_ip = ip2long($_SERVER['REMOTE_ADDR']);
     $login_time = time();
     // 禁止短時間內錯誤的登錄次數過多
     $timeline = strtotime("-5 minutes");
     if (AdminLoginLog::where('created_at', '>', date("Y-m-d H:i:s", $timeline))->where('admin_id', $admin_id)->where('log_status', '0')->count() > 3) {
         session()->flash('msg_error', '登錄失敗次數過多,請稍後再試');
         $request->flashOnly('username');
         return back();
     }
     $sPassword = md5($sPassword . md5($sPassword));
     $admin = Admin::where('username', $sUsername)->where('password', $sPassword)->first();
     // 賬號密碼錯誤
     if (!$admin) {
         $oAdminLoginLog->admin_id = $admin_id;
         $oAdminLoginLog->log_ip = $login_ip;
         $oAdminLoginLog->log_status = 0;
         // 失敗
         $oAdminLoginLog->save();
         session()->flash('msg_error', '賬號或密碼錯誤');
         $request->flashOnly('username');
         return back();
     }
     // session中存入id
     $request->session()->put('admin_id', $admin->id);
     $request->session()->put('username', $admin->username);
     // login ip && time update
     $admin->login_ip = $login_ip;
     $admin->login_time = $login_time;
     $admin->save();
     // 更新管理員登錄記錄表
     $oAdminLoginLog->admin_id = $admin->id;
     $oAdminLoginLog->log_ip = $login_ip;
     $oAdminLoginLog->log_status = 1;
     // 成功
     $oAdminLoginLog->save();
     // 登錄成功
     session()->flash('msg_error', '登錄成功');
     return redirect('/admin');
 }
開發者ID:smartgirl001,項目名稱:Test,代碼行數:69,代碼來源:AuthController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $input = $request->all();
     if (array_key_exists('selected-tags', $input)) {
         $this->snippet->where('id', $id)->update(['title' => $input['title'], 'body' => $input['body']]);
         // スニペットにタグを紐付ける
         $snippet = Snippet::find($id);
         $snippet->tags()->detach();
         $snippet->tags()->attach($input['selected-tags']);
         return redirect()->to("/snippet/{$id}");
     } else {
         \Session::flash('snippetFormError', '必ずタグを選択してください');
         $request->flashOnly('title', 'body');
         return redirect()->back()->withInput();
     }
 }
開發者ID:suzumi,項目名稱:giita,代碼行數:22,代碼來源:SnippetController.php


注:本文中的Illuminate\Http\Request::flashOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。