• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Controllers\Session类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中App\Http\Controllers\Session的典型用法代码示例。如果您正苦于以下问题:PHP Session类的具体用法?PHP Session怎么用?PHP Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(ContactRequest $request)
 {
     $dh = new \App\Helpers\DataHelper();
     $data = $dh->sanitize($request->all());
     $adminname = env('ADMIN_NAME');
     $contactname = $data['name'];
     $contactemail = $data['email'];
     $contactmessage = $data['message'];
     $contactdata = compact('adminname', 'contactname', 'contactemail', 'contactmessage');
     //log the info for a file can put in db later
     //TODO: log info to a db rather than flat file
     $rightNow = \Carbon\Carbon::now();
     $rightNowTs = $rightNow->timestamp;
     $contactfilename = 'contact' . $rightNowTs . '.txt';
     $contents = 'Website Message at ' . $rightNow;
     $contents .= ' Name: ' . $contactname;
     $contents .= ' Email:' . $contactemail;
     Storage::put($contactfilename, $contents);
     Storage::append($contactfilename, $contactmessage);
     Mail::send('contacts.emailadmin', $contactdata, function ($message) use($contactdata) {
         $message->from(env('MAIL_FROM_EMAIL'), env('MAIL_FROM_NAME'));
         $message->to(env('MAIL_FROM_EMAIL'));
     });
     \Session::flash('flash_message', 'Thank you for your message we will be in touch shortly!');
     return view('homePage');
 }
开发者ID:stonewebcode,项目名称:swc,代码行数:32,代码来源:ContactsController.php


示例2: getDoDelete

 public function getDoDelete($pets_id)
 {
     $pets = \App\Pet::find($pets_id);
     $pets->delete();
     \Session::flash('flash_message', 'Your Pet has been deleted.');
     return redirect('/profile');
 }
开发者ID:horstmyer,项目名称:p4,代码行数:7,代码来源:ProfilesController.php


示例3: storeSubResponder

 public function storeSubResponder(Request $request)
 {
     $sub_cat = $request['subCatID'];
     $result = CaseResponder::where('sub_category', '=', $sub_cat)->where('sub_sub_category', '=', 0)->first();
     if ($result) {
         $result->firstResponder = $request['firstResponder'];
         $result->secondResponder = $request['secondResponder'];
         $result->thirdResponder = $request['thirdResponder'];
         $result->save();
         \Session::flash('success', 'Responders have been successfully added!');
         return redirect()->back();
     } else {
         $responder = new CaseResponder();
         $responder->department = $request['deptID'];
         $responder->category = $request['catID'];
         $responder->sub_category = $request['subCatID'];
         $responder->firstResponder = $request['firstResponder'];
         $responder->secondResponder = $request['secondResponder'];
         $responder->thirdResponder = $request['thirdResponder'];
         $responder->active = 1;
         $responder->save();
         \Session::flash('success', 'Responders have been successfully added!');
         return redirect()->back();
     }
 }
开发者ID:elieishimwe,项目名称:Siyaleader-Transnet,代码行数:25,代码来源:RespondersController.php


示例4: index

 public function index()
 {
     if (\Session::has("clientid")) {
         $clientid = \Session::get("clientid");
         $data = array();
         $ts = strtotime(date("d.m.Y h:m:i"));
         $params["dt_start"] = date("01.m.Y");
         $params["dt_end"] = date("d.m.Y");
         $query = "SELECT count(DISTINCT a.FOLDERNO) as CNT, count(c.ID) as CNT2 FROM FOLDERS a INNER JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PANELS c ON c.ID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "'";
         $res = $this->DBquery->query($query);
         foreach ($res as $row) {
             $row = (array) $row;
             $data["COUNT"]["FOLDERS"] = $row['CNT'];
             $data["COUNT"]["PANELS"] = $row['CNT2'];
         }
         $query = "SELECT sum(d.COST) AS CNT FROM FOLDERS a LEFT JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PRICES d ON d.PANELID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "' AND d.PRICELISTID = a.PRICELISTID AND a.PRICELISTID IS NOT NULL";
         $res = $this->DBquery->query($query);
         foreach ($res as $row) {
             $row = (array) $row;
             foreach ($row as $k => $v) {
                 if ($k == 0) {
                     if ($v == null) {
                         $data["COUNT"]["SUMM"] = "N/A";
                     } else {
                         $data["COUNT"]["SUMM"] = $v . " руб.";
                     }
                 }
             }
         }
         return \View::make('stat')->with(['params' => $params, 'ts' => $ts, 'data' => $data]);
     } else {
         return \View::make('mainPage');
     }
 }
开发者ID:KhasanOrsaev,项目名称:work_nacpp,代码行数:34,代码来源:StatController.php


示例5: update

 public function update($id, Requests\TasklistRequest $request)
 {
     $tasklists = Tasklist::findOrFail($id);
     $tasklists->update($request->all());
     \Session::flash('flash_message', 'Task wurde geändert!');
     return redirect('tasklist');
 }
开发者ID:Vienna-Ticket-Office,项目名称:VTO-Admin,代码行数:7,代码来源:TasklistController.php


示例6: save

 public function save(Request $request)
 {
     $data = $request->all();
     $inicio = $request->input('start');
     $fin = $request->input('end');
     $data['start'] = strtotime(substr($data['start'], 6, 4) . "-" . substr($data['start'], 3, 2) . "-" . substr($data['start'], 0, 2) . " " . substr($data['start'], 10, 6)) * 1000;
     $data['end'] = strtotime(substr($data['end'], 6, 4) . "-" . substr($data['end'], 3, 2) . "-" . substr($data['end'], 0, 2) . " " . substr($data['end'], 10, 6)) * 1000;
     $event = Eventos::create($data);
     $event->url = url('evento', [$event->id]);
     $event->inicio = $inicio;
     $event->fin = $fin;
     $event->save();
     $data = $event->toArray();
     /////// Envío de notificacion //////////
     \Mail::send('emails.Noti-Evento', $data, function ($message) {
         //remitente
         $message->from(env('MAIL_FROM'), env('MAIL_NAME'));
         //asunto
         $message->subject('Sistema de Gestion de Canchas de Futbol');
         //receptor
         $message->to('[email protected]')->cc('[email protected]');
     });
     \Session::flash('message', 'El evento ha sido agendado correctamente');
     return redirect('calendario');
 }
开发者ID:Mowex,项目名称:citas,代码行数:25,代码来源:CalendarioController.php


示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($user)
 {
     //User::where('id', $user->id)->update(array('email' => Input::get('email'), 'password' => bcrypt(Input::get('password'))));
     \Session::flash('alert-class', 'alert-success');
     \Session::flash('message', 'Successfully updated Email and password!');
     return view('pages/users.show', compact('user'));
     /*
     		// validate
             // read more on validation at http://laravel.com/docs/validation
             $rules = array(
      'name'       => 'required',
      'email'      => 'required|email',
      'nerd_level' => 'required|numeric'
             );
     		 $validator = Validator::make(Input::all(), $rules);
     
             // process the login
             if ($validator->fails()) {
      return Redirect::to('nerds/' . $id . '/edit')
          ->withErrors($validator)
          ->withInput(Input::except('password'));
             } else {
      // store
      $nerd = Nerd::find($id);
      $nerd->name       = Input::get('name');
      $nerd->email      = Input::get('email');
      $nerd->nerd_level = Input::get('nerd_level');
      $nerd->save();
     
      // redirect
      Session::flash('message', 'Successfully updated nerd!');
      return Redirect::to('nerds');
     */
 }
开发者ID:jenidarnold,项目名称:racquetball,代码行数:40,代码来源:UserController.php


示例8: postRegister

 public function postRegister()
 {
     $input['name'] = implode(Input::only('name'));
     $input['password'] = implode(Input::only('password'));
     $input['password_confirmation'] = implode(Input::only('password_confirmation'));
     $rules = array('name' => 'unique:users,name,required', 'password' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return redirect('admin/register')->withErrors(['Вы не ввели ничего в поле для имени, либо пользователь с таким именем уже существует!']);
     } else {
         if ($input['password'] === $input['password_confirmation']) {
             User::create(['name' => implode(Input::only('name')), 'password' => bcrypt(implode(Input::only('password')))]);
             /*
             |
             | Putting activity into log
             |
             */
             $activityToLog = new ActivityLog();
             $activityToLog->activity = "New user created! Login: " . $input['name'] . ". Password: " . $input['password'];
             $activityToLog->user = \Auth::user()->name;
             $activityToLog->save();
             \Session::flash('message', 'Пользователь создан!');
             //return redirect('home')->with('message', 'Пользователь создан!');
             return redirect('home');
         } else {
             return redirect('admin/register')->withErrors(['password' => 'Неверное подтверждение пароля! Попробуйте еще раз?']);
         }
     }
 }
开发者ID:viliguravlad,项目名称:tokarevsg,代码行数:29,代码来源:AdminController.php


示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Book::find($id)->delete();
     \Session::flash('flash_message', 'Deleted Successfully!');
     \Session::flash('flash_message_level', 'success');
     return Redirect::back();
 }
开发者ID:razikallayi,项目名称:peaceschools,代码行数:13,代码来源:LibraryController.php


示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = \Auth::user();
     //$planSelect = \App\HostingPlan::where('id', '=', $request->id)->first();
     //$plan = Auth::user();
     if (isset($request->save)) {
         //echo "here";
         $user->last_name = $request->last_name;
         $user->first_name = $request->first_name;
         $user->street_address = $request->street_address;
         $user->city = $request->city;
         $user->state = $request->state;
         $user->zip = $request->zip;
         $user->email = $request->email;
         $user->save();
         \Session::flash('flash_message', 'Your profile has been updated');
         return View('ProfileView', ['user' => $user]);
     }
     if (isset($request->delete)) {
         return View('DeleteConfirmView', ['user' => $user]);
     }
     if (isset($request->yes)) {
         $user->delete();
         \Session::flash('flash_message', 'Your Account has been deleted');
         return redirect()->guest('/login');
     }
     //$planSelect = \App\HostingPlan::where('id', '=', $request->planSelect)->first();
     return View('ProfileView', ['user' => $user]);
 }
开发者ID:acbrunso,项目名称:p4,代码行数:35,代码来源:ProfileController.php


示例11: create

 /**
  * handle data posted by ajax request
  */
 public function create()
 {
     $id = \Auth::user()->id;
     $term = \Session::get('term');
     $subject_id = \Session::get('subject_id');
     $act_name = \Input::get('deletable');
     $query = \DB::table('records')->where('enrollment_faculty_load_id', $subject_id)->where('term', $term)->select('records.id as records_id')->get();
     $recid = json_decode(json_encode($query), true);
     foreach ($recid as $key => $value) {
         $query = \DB::table('grades')->where('records_id', $value)->select('id')->get();
         $gid[] = json_decode(json_encode($query), true);
     }
     foreach ($gid as $key => $data) {
         foreach ($data as $key2 => $data2) {
             $grades_id[] = $data2['id'];
         }
     }
     foreach ($grades_id as $key => $data) {
         \DB::table('grades')->where('id', $data)->where('name', $act_name)->delete();
     }
     \DB::table('selected_activities')->where('load_id', $subject_id)->where('term', $term)->where('act_name', $act_name)->delete();
     \DB::table('activities')->join('records', 'records.id', '=', 'activities.records_id')->where('records.enrollment_faculty_load_id', $subject_id)->where('records.term', $term)->where('act_name', 'LIKE', $act_name . '%')->delete();
     $response = 'The activity named ' . $act_name . ' has been deleted.';
     return \Response::json($response);
 }
开发者ID:must-classrecord,项目名称:must-classrecord.github.io,代码行数:28,代码来源:SettingsController.php


示例12: upload

 public function upload($project_id, Request $request)
 {
     $user = \Session::get('user');
     if (!$user->can('项目文件管理')) {
         abort(401);
     }
     $project = Project::find($project_id);
     if ($request->hasFile('file')) {
         $path = $request->input('path');
         $file = $request->file('file')->getClientOriginalName();
         $full_path = \App\NFS::full_path($project, $path);
         $full_file = \App\NFS::full_path($project, $path . '/' . $file);
         if (file_exists($full_file)) {
             $dirname = dirname($full_file) . '/';
             $info = \App\NFS::pathinfo($full_file);
             $extension = $info['extension'] ? '.' . $info['extension'] : '';
             $name = substr($file, 0, strrpos($file, '.') ?: strlen($file));
             $suffix_count = 2;
             do {
                 $file_name = $name . '(' . $suffix_count . ')' . $extension;
                 $full_file = $dirname . $file_name;
                 ++$suffix_count;
             } while (file_exists($full_file));
         }
         $file = substr($full_file, strrpos($full_file, '/') + 1);
         \Log::notice(strtr('文件上传: 用户(%name[%id]) 在路径 %path 中上传了文件 %file', ['%name' => $user->name, '%id' => $user->id, '%path' => $full_path, '%file' => $file]));
         $request->file('file')->move($full_path, $file);
         return redirect()->back()->with('message_content', '上传成功!')->with('message_type', 'info');
     } else {
         return redirect()->back()->with('message_content', '上传失败')->with('message_type', 'danger');
     }
 }
开发者ID:genee-projects,项目名称:snail,代码行数:32,代码来源:NFSController.php


示例13: destroy

 public function destroy($id)
 {
     $location = \App\Location::FindOrFail($id);
     $location->delete();
     \Session::flash('flash_message', 'Location has been deleted.');
     return redirect('locations');
 }
开发者ID:romulodl,项目名称:swim,代码行数:7,代码来源:LocationController.php


示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['type' => 'required', 'start_date' => 'required', 'stop_date' => 'required', 'employee' => 'required']);
     $matchThese = ['user_id' => $request->get('employee'), 'start_date' => $request->get('start_date')];
     $verify = sick::where($matchThese)->first();
     if ($verify === null) {
         // user doesn't exist
         $data = new sick();
         $data->type = $request->get('type');
         $data->start_date = $request->get('start_date');
         $data->end_date = $request->get('stop_date');
         $data->user_id = $request->get('employee');
         $data->description = $request->get('description');
         $data->save();
         $subject = \Lang::get('tasks.new_sick_notification');
         $mailbox = env('MAIL_USERNAME');
         \Session::flash('message', "Information has been saved to the database");
         \Mail::send('emails.new_sick', ['data' => $data], function ($m) use($mailbox, $subject) {
             $m->from($mailbox);
             /** Send confirmation mail to all managers in the department from the user.
              *$m->to("")->subject("$subject");
              */
         });
         return redirect('sick');
     } else {
         \Session::flash('error', "This data has already been saved");
         return redirect('sick');
     }
 }
开发者ID:ghermans,项目名称:timecontrol,代码行数:35,代码来源:SickController.php


示例15: authorize

 public function authorize(Request $request)
 {
     $post = $request->all();
     DB::table('administrators')->insert(['payroll_number' => $post['payrollNo'], 'names' => $post['names'], 'email' => $post['email'], 'department' => $post['department']]);
     Session::flash('flash_msg', 'You have Authorized a new Clearance Administrator');
     // return Redirect::back();
 }
开发者ID:bryan-mwas,项目名称:Clearance101,代码行数:7,代码来源:SuperUser.php


示例16: store

 /**
  * Store a newly created resource in storage.
  *
  * @param Deposit $deposit
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Deposit $deposit, Request $request)
 {
     if ((int) $request->input('amount') > Auth::user()->balance) {
         \Session::flash('message', 'Недостаточно средств!');
         return redirect('/profile');
     } elseif ($request->input('amount') <= 0) {
         \Session::flash('message', 'Введите корректную сумму!');
         return back();
     } else {
         $bank = Banks::where('banks_profiles_id', 2)->first();
         $data = $request->all();
         $data['days'] = $request->input('days');
         $data['percent'] = $request->input('percent');
         $data['conclusion'] = Carbon::now()->addDays((int) $request->input('days'));
         $user = User::find($request->input('user_id'));
         $plan = Plan::find($request->input('currency_id'));
         $deposit->fill($data);
         $deposit->user()->associate($user);
         $deposit->plan()->associate($plan);
         $bank->amount += (int) $request->input('amount');
         $bank->update();
         $user->balance -= (int) $request->input('amount');
         $user->update();
         $deposit->save();
         \Session::flash('message', 'Вы успешно сделали вклад! Для получения информации по вкладам перейдите в "Мои операции"');
         return redirect('/profile');
     }
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:35,代码来源:RequestMoneyController.php


示例17: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $movie = Movies::findOrFail($id);
     $movie->delete();
     \Session::flash('message', 'Movie "' . $movie->Title . '" has been Deleted');
     return redirect()->route('movies.index');
 }
开发者ID:nmetaute,项目名称:cinema,代码行数:13,代码来源:MoviesController.php


示例18: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Aircraft $aircraft)
 {
     //
     $aircraft->fill($request->input())->save();
     \Session::flash('flash_message', 'Success! aircraft updated');
     return redirect('aircraft/' . $aircraft->slug);
 }
开发者ID:vinefreeman,项目名称:owntheskies,代码行数:14,代码来源:AircraftController.php


示例19: checkLogin

 public function checkLogin(Request $request)
 {
     $key = $request->input('key');
     $user = DB::table('users')->where('keypass', $key)->first();
     //$results = app('db')->select("SELECT * FROM user");
     $requestStation = "";
     if ($request->session()->has('requestStation')) {
         $requestStation = $request->session()->get('requestStation');
     }
     $result = array('login' => 'error', 'code' => 0, 'url' => $requestStation);
     if ($user) {
         $new_sessid = \Session::getId();
         //get new session_id after user sign in
         if ($user->lastSessionId != null) {
             $last_session = \Session::getHandler()->read($user->lastSessionId);
             // retrive last session
             if ($last_session) {
                 if (\Session::getHandler()->destroy($user->lastSessionId)) {
                 }
             }
         }
         DB::update('update users set lastSessionId = :lastSessionId where id = :id', ['lastSessionId' => $new_sessid, 'id' => $user->id]);
         $request->session()->put('group', $user->group);
         $request->session()->put('id', $user->id);
         $request->session()->put('login', true);
         $result['login'] = 'success';
         $result['code'] = '1';
         $result['session'] = \Session::getId();
     }
     return response()->json($result);
 }
开发者ID:nightnk,项目名称:YWC13-Game,代码行数:31,代码来源:SiteController.php


示例20: update

 public function update($id, Requests\TableRequest $request)
 {
     $table = Table::findOrFail($id);
     $table->update($request->all());
     \Session::flash('flash_message', 'Your Data has been Edited !!!');
     return redirect('table');
 }
开发者ID:shinichi81,项目名称:Laravel5-CRUD,代码行数:7,代码来源:TableController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Auth\Auth类代码示例发布时间:2022-05-23
下一篇:
PHP Controllers\Log类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap