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


PHP Session::has方法代码示例

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


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

示例1: addToBasket

 public function addToBasket(Request $request)
 {
     $array = $request->input('prod_id');
     $array2 = json_decode($array);
     if (!\Session::has('product8')) {
         \Session::put('product8.' . $array2[0], $array2[0]);
         \Session::put('product8.' . $array2[0] . '.kolvo', 1);
         \Session::put('product8.' . $array2[0] . '.img', $array2[1]);
         \Session::put('product8.' . $array2[0] . '.title', $array2[2]);
         \Session::put('product8.' . $array2[0] . '.content', $array2[3]);
         \Session::put('product8.' . $array2[0] . '.price', $array2[4]);
         if (!\Session::has('addToBasket')) {
             \Session::put('addToBasket', 1);
             // общий счетчик товара
         }
     } else {
         if (!array_key_exists($array2[0], \Session::get('product8'))) {
             $kol = \Session::get('addToBasket');
             \Session::put('addToBasket', $kol + 1);
             \Session::put('product8.' . $array2[0], $array2[0]);
             \Session::put('product8.' . $array2[0] . '.kolvo', 1);
             \Session::put('product8.' . $array2[0] . '.img', $array2[1]);
             \Session::put('product8.' . $array2[0] . '.title', $array2[2]);
             \Session::put('product8.' . $array2[0] . '.content', $array2[3]);
             \Session::put('product8.' . $array2[0] . '.price', $array2[4]);
         }
     }
     return \Session::get('addToBasket');
 }
开发者ID:rmvl,项目名称:mebeli-magaz,代码行数:29,代码来源:AjaxController.php

示例2: autoLogin

 private function autoLogin()
 {
     try {
         if (\Session::has('userID')) {
         } else {
             //try set session from cookies if no session
             if (!empty(\Cookie::get('userID'))) {
                 $field = array('field' => '_id', 'value' => (string) \Cookie::get('userID'));
                 if (Auth::isExists($field)) {
                     \Session::put('userID', \Cookie::get('userID'));
                     //
                     //return \Response::make()->withCookie(\Cookie::make('userID', \Cookie::get('userID') , self::COOKIE_EXPIRE));
                 } else {
                     throw new AuthCheckException('username', 'auth.username.doesnt.exist');
                 }
             } else {
                 //\Session::forget('userID')->withCookie(\Cookie::forget('userID'))->withCookie(\Cookie::forget('userID'));
                 throw new AuthCheckException('userid', 'auth.userid.doesnt.exist');
             }
         }
     } catch (Exception $e) {
         $return = \Response::json(["message" => "Session logout!"], 400);
         \Session::forget('userID');
         return $return->withCookie(Cookie::forget('userID'))->withCookie(Cookie::forget('userID'));
     }
 }
开发者ID:stevetay,项目名称:MCMC,代码行数:26,代码来源:RegionController.php

示例3: input

 /**
  * show and handle input page
  *
  * @author My Vo
  *
  * @return \Illuminate\View\View
  */
 public function input(Prj02FormR5 $prj02FormR5)
 {
     $this->checkSession($this->catalogItem);
     // Get array catalog item in select page
     $dct = $this->getCatalogItem();
     // check dct
     $count = count(array_intersect($dct, \Session::get('distinct')));
     $min = \Config::get('constants.MIN_CATALOG');
     if ($count > 1 || count($dct) < $min) {
         \Session::forget('dct');
         return redirect()->route('owner-select')->withErrors(['dct' => '選択カタログは']);
     }
     \Session::put('cat_item', $this->catalogItem);
     $platFormID = $prj02FormR5->platform;
     if (!\Session::has('id')) {
         \Session::put('id', $platFormID);
     }
     \Session::put('dct', $dct);
     $form = \Helper::getFormTable($this->catalogItem);
     // Generate file name for model
     $file_name = $prj02FormR5->platformName;
     \Helper::catalogLoad($platFormID, $file_name);
     $catalogList = $file_name . $platFormID . 'List';
     // Get old input
     $info_input = array();
     if (\Session::has('info_input')) {
         $info_input = \Session::get('info_input');
     }
     return view('pages.default.catalog.r5.input', ['catalogItem' => $this->catalogItem, 'dct' => $dct, 'id' => $platFormID, 'form' => $form, 'catalogList' => $catalogList, 'info_input' => $info_input]);
 }
开发者ID:vodanh624321,项目名称:laravel5,代码行数:37,代码来源:CatalogR5Controller.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: show_tree

 public function show_tree($id)
 {
     try {
         // check this guy exist or not
         $result = array();
         $r = DB::table('persons')->where('person_id', '=', $id)->where('deleted_flag', '=', false)->first();
         if (count($r) == 0) {
             $result['Info']['status'] = "Complete";
             $result['Info']['message'] = "No Person Found";
             return response()->json($result, 200);
         }
         $result['Info']['status'] = "Complete";
         $result['Info']['message'] = "Found";
         if (\Session::has('focused_id')) {
             \Session::set('focused_id', $id);
         } else {
             \Session::put('focused_id', $id);
         }
         $this->list[] = $r->person_id;
         // Let's fill personal information to id array list.
         $result = $this->adjustArrayForTree($result, 10);
         //$result = $this->remove_NonRelevance($result, $id);
         //$result = $this->sortTree($result);
         return response()->json($result, 200);
     } catch (Exception $e) {
         $result['status'] = "Error";
         $result['message'] = $e;
         return response()->json($result, 200);
     }
 }
开发者ID:silenus092,项目名称:health_system,代码行数:30,代码来源:ApiController.php

示例6: __construct

 public function __construct()
 {
     if (\Session::has('tempuser.token')) {
     } else {
         //dd(\Session::has('tempuser.token'));
         throw new AuthCheckException('base', 'invalid session');
     }
 }
开发者ID:stevetay,项目名称:MCMC,代码行数:8,代码来源:BaseController.php

示例7: getLogout

 public function getLogout()
 {
     if (\Session::has('UserID')) {
         \Session::forget('UserID');
     }
     $this->auth->logout();
     return redirect(url('/user/login'));
 }
开发者ID:bluelinemango,项目名称:mango,代码行数:8,代码来源:LoginController.php

示例8: error403

 public function error403()
 {
     $error = null;
     if (\Session::has('error')) {
         $error = \Session::get('error');
     }
     return response(view("errors.403", compact('error')), 403);
 }
开发者ID:linguisticteam,项目名称:laravel-boilerplate,代码行数:8,代码来源:ErrorController.php

示例9: delete

 public function delete($id)
 {
     if (\Session::has('product8')) {
         \Session::forget('product8.' . $id);
         $kol = \Session::get('addToBasket');
         \Session::forget('addToBasket', $kol - 1);
     }
     return redirect('basket');
 }
开发者ID:rmvl,项目名称:mebeli-magaz,代码行数:9,代码来源:BasketController.php

示例10: sessionFilter

 public function sessionFilter()
 {
     if (Session::has('account')) {
         if (Session::get('login-date') != date("Ymd")) {
             $this->export(413);
             die;
         }
     } else {
         Session::set('account', array('uid' => 1));
         Session::set('login-date', date("Ymd"));
     }
 }
开发者ID:AngelHorn,项目名称:gamification,代码行数:12,代码来源:Controller.php

示例11: delete_ads

 public function delete_ads($id)
 {
     if (\Session::has('tempuser.token')) {
         if ($id) {
             DB::delete("delete from advertisements where adv_id = '" . $id . "' ");
             return \Redirect::route('table');
         } else {
             return "Error! no id!";
         }
     } else {
         return \Redirect::route('login');
     }
 }
开发者ID:stevetay,项目名称:MCMC,代码行数:13,代码来源:adminController.php

示例12: getVisuri

 public function getVisuri(Request $req)
 {
     $sort = $req->input('sort', null);
     $query = Dream::orderBy('created_at');
     if (!is_null($sort)) {
         $query->orderBy($sort);
         \Session::put('dreams_sort', $sort);
     } elseif (\Session::has('dreams_sort')) {
         $query->orderBy(\Session::get('dreams_sort'));
     }
     $data['models'] = $query->paginate($this->pageSize);
     return view('administration.visuri', $data);
 }
开发者ID:alexandrugheorghe,项目名称:11feb2016,代码行数:13,代码来源:AdminController.php

示例13: getVisuri

 public function getVisuri(Request $req)
 {
     $sort = $req->input('sort', null);
     $week = $req->input('week', null);
     $page = $req->input('page', 0);
     date_default_timezone_set('Europe/Bucharest');
     $startDate = new Carbon(\Config::get('constants.start_date'));
     $currentDate = Carbon::now();
     $endDate = $currentDate;
     $daysDiff = $currentDate->diff($startDate)->days;
     $weeksDiff = floor($daysDiff / 7);
     if (is_null($week)) {
         $week = $weeksDiff;
     }
     if (is_numeric($week) && $week < $weeksDiff) {
         $startDate->addWeeks($week);
         $endDate = $startDate->copy();
         $endDate->addWeek()->subDay();
     } else {
         if ($weeksDiff > 0) {
             $startDate->addWeeks($weeksDiff);
         }
     }
     $query = Dream::with('user');
     $query = Dream::whereBetween('approved_at', [$startDate, $endDate]);
     $totalPages = $query->count() / $this->pageSize;
     if (is_numeric($page) && $page > 0 && $page <= $totalPages) {
         $query->skip($page * $this->pageSize);
     }
     if (!is_null($sort)) {
         \Session::put('dreams_sort', $sort);
     }
     if (\Session::has('dreams_sort')) {
         $sort = \Session::get('dreams_sort');
         switch ($sort) {
             case 'approved_at':
                 $data['models'] = $query->orderBy($sort, 'ASC')->take($this->pageSize)->get();
                 break;
             case 'votes':
                 $data['models'] = $query->orderBy($sort, 'DESC')->take($this->pageSize)->get();
                 break;
         }
     } else {
         $data['models'] = $query->take($this->pageSize)->get();
     }
     $data['totalPages'] = $totalPages;
     $data['totalWeeks'] = $weeksDiff;
     $data['currentWeek'] = $week ? $week : $weeksDiff;
     $data['currentPage'] = $page;
     return view('visuri', $data);
 }
开发者ID:alexandrugheorghe,项目名称:11feb2016,代码行数:51,代码来源:DreamsController.php

示例14: index

 public function index()
 {
     $f = new FuncControllers();
     if (!\Session::has('clientid')) {
         return \View::make('main');
     } else {
         // if ($f->isOwner(\Input::get("folderno"), \Session::get('clientid'))) {
         $f->do_dellfolderno(\Input::get("folderno"));
         //return redirect('main');
         // } else {
         return redirect('http://nacpp.info/main');
         //     echo "fail";
         // }
     }
 }
开发者ID:KhasanOrsaev,项目名称:work_nacpp,代码行数:15,代码来源:RequestDelete.php

示例15: anyInput

 public function anyInput($catalogItem, Prj02Catalog $prj02Catalog)
 {
     $this->checkSession($catalogItem);
     $flag = $this->selectDefault($catalogItem);
     \Session::put('cat_item', $catalogItem);
     // Get array catalog item in select page
     $dct = $this->getCatalogItem();
     // Check array catalog
     $number = count($dct);
     if ($number <= \Config::get('constants.MAX_CATALOG') && $number >= \Config::get('constants.MIN_CATALOG')) {
         $platFormID = $prj02Catalog->platform;
         if (!\Session::has('id')) {
             \Session::put('id', $platFormID);
         }
         \Session::put('dct', $dct);
         $form = \Helper::getFormTable($catalogItem);
         // Generate file name for modal
         $file_name = $prj02Catalog->platformName;
         \Helper::catalogLoad($platFormID, $file_name);
         $catalogList = $file_name . $platFormID . 'List';
         //get infomation dct
         foreach ($dct as $item) {
             $arrDctInfo[] = \Cache::get($catalogList)[$item];
         }
         // Get old input
         $info_input = array();
         if (\Session::has('info_input')) {
             $info_input = \Session::get('info_input');
         }
         $path = null;
         $view = 'input';
         if ($form == 'input-r2') {
             $path = 'r2';
             $view = 'input-r2';
         }
         return view('pages.default.catalog.' . $path . '.' . $view, ['catalogItem' => $catalogItem, 'dct' => $dct, 'id' => $platFormID, 'form' => $form, 'catalogList' => $catalogList, 'info_input' => $info_input, 'flag' => $flag, 'panel' => $this->checkVisualArea($catalogItem), 'arrDctInfo' => $arrDctInfo]);
     }
     return redirect()->route('catalog-select', compact('catalogItem'))->withErrors(['dct' => '選択カタログは、1個から3個の間で指定してください。']);
 }
开发者ID:vodanh624321,项目名称:laravel5,代码行数:39,代码来源:CatalogController.php


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