本文整理汇总了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]);
}
示例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' => '用戶名或密碼錯誤!']);
}
示例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]);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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');
}
示例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();
}
}