当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::flash方法代码示例

本文整理汇总了PHP中Illuminate\Http\Request::flash方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::flash方法的具体用法?PHP Request::flash怎么用?PHP Request::flash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Http\Request的用法示例。


在下文中一共展示了Request::flash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticated

 /**
  * Overrides the action when a user is authenticated.
  * If the user authenticated but does not exist in the user table we create them.
  * @param Request $request
  * @param Authenticatable $user
  * @return \Illuminate\Http\RedirectResponse
  * @throws AuthException
  */
 protected function authenticated(Request $request, Authenticatable $user)
 {
     // Explicitly log them out for now if they do no exist.
     if (!$user->exists) {
         auth()->logout($user);
     }
     if (!$user->exists && $user->email === null && !$request->has('email')) {
         $request->flash();
         session()->flash('request-email', true);
         return redirect('/login');
     }
     if (!$user->exists && $user->email === null && $request->has('email')) {
         $user->email = $request->get('email');
     }
     if (!$user->exists) {
         // Check for users with same email already
         $alreadyUser = $user->newQuery()->where('email', '=', $user->email)->count() > 0;
         if ($alreadyUser) {
             throw new AuthException('A user with the email ' . $user->email . ' already exists but with different credentials.');
         }
         $user->save();
         $this->userRepo->attachDefaultRole($user);
         auth()->login($user);
     }
     $path = session()->pull('url.intended', '/');
     $path = baseUrl($path, true);
     return redirect($path);
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:36,代码来源:LoginController.php

示例2: update

 public function update(Request $request, $id = 0)
 {
     if ($id) {
         try {
             $role = Role::findOrFail($id);
         } catch (ModelNotFoundException $e) {
             $request->flash();
             return redirect('admin/role', ['errors' => $e]);
         }
     } else {
         return redirect('admin/role', ['errors' => 'ID is missing. ']);
     }
     $data = ['name' => $request->input('name'), 'slug' => $request->input('slug'), 'description' => $request->input('description'), 'level' => $request->input('level')];
     $validator = Validator::make($data, ['name' => 'required', 'slug' => "required|unique:roles,slug,{$id}|alpha", 'level' => 'required|integer']);
     if ($validator->fails()) {
         $request->flash();
         return view('admin.role.show', ['act' => $id, 'role' => [], 'errors' => $validator->messages()]);
     } else {
         $role->name = $data['name'];
         $role->slug = $data['slug'];
         $role->description = $data['description'];
         $role->level = $data['level'];
         $role->save();
         return redirect('admin/role');
     }
 }
开发者ID:Lostvincent,项目名称:taoaixin,代码行数:26,代码来源:RoleController.php

示例3: index

 public function index(Request $request)
 {
     $request->flash();
     $items = Item::search($request);
     // dd($request);
     return view('spareparts.index', compact('items'));
 }
开发者ID:renciebautista,项目名称:sparepartsfinder,代码行数:7,代码来源:SparepartsController.php

示例4: postPost

 public function postPost(Request $request)
 {
     $input = $request->all();
     $rules = ['title' => ['max:20', 'required'], 'content' => ['min:10', 'required']];
     $validator = Validator::make($input, $rules);
     $returnInf = [];
     if ($validator->fails()) {
         $messages = $validator->messages();
         foreach ($array_dot($messages->toArray) as $value) {
             array_push($returnInf, $value);
         }
         Session::flash('operationResult', 'am-alert-warning');
         Session::flash('returnInf', $returnInf);
         return redirect()->back()->withInput(Request::flash());
     } else {
         $article = Article::create(['title' => $input['title'], 'content' => Common::encodeTopicContent($input['content']), 'node_id' => $input['node_id'], 'user_id' => $input['user_id']]);
         if ($article->id > 0) {
             array_push($returnInf, '发帖成功');
             Session::flash('operationResult', 'am-alert-success');
             Node::find($input['node_id'])->increment('article_count');
             User::find($input['user_id'])->increment('article_count');
         } else {
             array_push($returnInf, '我们的数据库出问题啦,请稍后再试=。=');
             Session::flash('operationResult', 'am-alert-warning');
         }
     }
     Session::flash('returnInf', $returnInf);
     return redirect()->back();
 }
开发者ID:xiaoxielaine,项目名称:hilaravel,代码行数:29,代码来源:UserController.php

示例5: postLogin

 public function postLogin(Request $request)
 {
     if (Auth::attempt(['name' => Input::get('name'), 'password' => Input::get('password')])) {
         return Redirect::to('index');
     } else {
         return Redirect::to('login')->with('data', 'Login Failed')->withInput($request->flash());
     }
 }
开发者ID:avivhazor,项目名称:EveryLeads,代码行数:8,代码来源:WebsiteController.php

示例6: validate

 /**
  * Validate the given request with the given rules.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  array  $rules
  * @param  array  $messages
  * @param  array  $customAttributes
  * @return void
  * @throws HttpException
  */
 public function validate(Request $request, array $rules, array $messages = [], array $customAttributes = [])
 {
     /** @var \Illuminate\Validation\Validator $validator */
     $validator = Validator::make($request->all(), $rules, $messages, $customAttributes);
     if ($validator->fails()) {
         $request->flash();
         throw new HttpException(Response::HTTP_NOT_ACCEPTABLE, $validator->errors()->first());
     }
 }
开发者ID:xpressengine,项目名称:xpressengine,代码行数:19,代码来源:SeoController.php

示例7: postLogin

 public function postLogin(Request $request)
 {
     if (Auth::attempt(['email' => $request['email'], 'password' => $request['password'], 'active' => 1])) {
         return redirect('admin/home');
     } else {
         $request->flash();
         return redirect('/admin/login')->withInput($request->only('email', 'remember'))->withErrors(['email' => 'These credentials do not match our records.']);
     }
 }
开发者ID:premsingh4github,项目名称:laravel_pingpong,代码行数:9,代码来源:AdminController.php

示例8: validate

 /**
  * Validate the given request with the given rules.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  array  $rules
  * @param  array  $messages
  * @param  array  $customAttributes
  * @return void
  * @throws HttpXpressengineException
  */
 public function validate(Request $request, array $rules, array $messages = [], array $customAttributes = [])
 {
     $validator = Validator::make($request->all(), $rules, $messages, $customAttributes);
     if ($validator->fails()) {
         $request->flash();
         $e = new HttpXpressengineException(Response::HTTP_NOT_ACCEPTABLE);
         $e->setMessage($validator->errors()->first());
         throw $e;
     }
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:20,代码来源:SeoController.php

示例9: lists

 /**
  * @param Guard   $auth
  * @param Request $request
  * @param string  $rp_id
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function lists(Guard $auth, Request $request, $rp_id)
 {
     $data = $this->data($auth->user());
     $headers = [];
     if ($request->has('_token')) {
         $request->flash();
     }
     $headers = $this->repository->getHeaderList($request);
     return view('td.pre-approved.list', compact('rp_id', 'headers', 'data'));
 }
开发者ID:sibasbo,项目名称:sibas,代码行数:17,代码来源:PreApprovedController.php

示例10: login

 public function login(Request $request)
 {
     $email = $request->get('email');
     $password = $request->get('password');
     if (\Auth::attempt(['email' => $email, 'password' => $password])) {
         return redirect(route('home'));
     } else {
         $request->flash();
         return view('auth/login');
     }
 }
开发者ID:bddevsclub,项目名称:website,代码行数:11,代码来源:AuthController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $request->flash();
     $users = User::search($request);
     // $roles = Role::where('id', '>', 2)->first();
     // if(!empty($roles)){
     //     $users = $roles->users()->get();
     // }
     $roles = Role::orderBy('name')->lists('name', 'id');
     return view('store_user.index', compact('users', 'roles'));
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:16,代码来源:StoreUserController.php

示例12: login

 protected function login(Request $request)
 {
     // we flash the request
     $request->flash();
     // we sanitize the entries
     $request->replace(InputSanitizer::sanitize($request->all()));
     // we set the remember to false if we do not find it
     $request->merge(['remember' => $request->get('remember', false)]);
     // we check the inputs validity
     $rules = ['email' => 'required|email', 'password' => 'required', 'remember' => 'required|boolean'];
     if (!Validation::check($request->all(), $rules)) {
         return redirect()->back();
     }
     // we try to authenticate the user
     try {
         if (!($user = Sentinel::authenticate($request->except('remember'), $request->get('remember')))) {
             Modal::alert([trans('auth.message.login.failure')], 'error');
             return redirect()->back();
         }
         // we notify the current user
         Modal::alert([trans('auth.message.login.success', ['name' => $user->first_name . " " . $user->last_name])], 'success');
         // redirect to the url stored in the session
         if ($url = session()->get('previous_url')) {
             session()->forget('previous_url');
             return redirect($url);
         } else {
             // or redirect to home
             return redirect(route('home'));
         }
     } catch (NotActivatedException $e) {
         // we log the error
         CustomLog::error($e);
         // we notify the current user
         Modal::alert([trans('auth.message.activation.failure'), trans('auth.message.activation.email.resend', ['email' => $request->get('email'), 'url' => route('account.activation_email', ['email' => $request->get('email')])])], 'error');
         return redirect()->back();
     } catch (ThrottlingException $e) {
         switch ($e->getType()) {
             case 'ip':
                 // we notify the current user
                 Modal::alert([trans('auth.message.throttle.ip', ['seconds' => $e->getDelay()])], 'error');
                 break;
             default:
                 // we notify the current user
                 Modal::alert([$e->getMessage()], 'error');
                 break;
         }
         return redirect()->back();
     } catch (Exception $e) {
         // we notify the current user
         \Modal::alert([trans('auth.message.login.error'), trans('global.message.global.failure.contact.support', ['email' => config('settings.support_email')])], 'error');
         return redirect()->back();
     }
 }
开发者ID:Okipa,项目名称:una.app,代码行数:53,代码来源:AuthController.php

示例13: showGamesForm

 /**
  * Shows Form to save games in database.
  *
  * @vereine array
  */
 public function showGamesForm(Request $request)
 {
     $matchday = $request->input('matchday');
     $league = $request->input('league');
     $season = $request->input('season');
     $getLeague = DB::table('leagues')->select('league')->get();
     $getSeason = DB::table('matches')->select('season')->groupBy('season')->get();
     $getMatchdayCount = Matches::select('matchday')->groupBy('matchday')->get();
     $request->flash();
     $matches = Matches::where('matchday', $matchday)->where('leagues.league', $league)->where('matches.season', $season)->join('clubs as homeclub', 'matches.home_id', '=', 'homeclub.id')->join('clubs as awayclub', 'matches.away_id', '=', 'awayclub.id')->join('leagues', 'matches.league_id', '=', 'leagues.id')->select('matches.*', 'homeclub.club as home', 'awayclub.club as away', 'leagues.league')->orderBy('date')->get();
     return view('admin.savematches', compact('matches', 'getMatchdayCount', 'getLeague', 'getSeason', 'league', 'season'));
 }
开发者ID:sewede,项目名称:footipp,代码行数:17,代码来源:SpieleController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     // get category in select field for filtering
     $category = $request->get('category');
     // filter by catergoy
     if ($category && $category != 'All') {
         $threads = Thread::where('category', $category)->orderBy('created_at', 'desc')->get();
     } else {
         $threads = Thread::orderBy('created_at', 'desc')->get();
     }
     // Flash old input to repopulate on search
     $request->flash();
     return view('threads.index', ['threads' => $threads]);
 }
开发者ID:shannonfarvolden,项目名称:CourseCanvas,代码行数:19,代码来源:ThreadsController.php

示例15: delete

 public function delete(Request $request, $id = 0)
 {
     if ($id) {
         try {
             $user = User::findOrFail($id);
         } catch (ModelNotFoundException $e) {
             $request->flash();
             return redirect('admin/user', ['act' => $id, 'errors' => $e]);
         }
     } else {
         return redirect('admin/user');
     }
     $user->delete();
     return redirect('admin/user');
 }
开发者ID:Lostvincent,项目名称:taoaixin,代码行数:15,代码来源:UserController.php


注:本文中的Illuminate\Http\Request::flash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。