本文整理汇总了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');
}
示例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'));
}
}
示例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]);
}
示例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');
}
}
示例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);
}
}
示例6: __construct
public function __construct()
{
if (\Session::has('tempuser.token')) {
} else {
//dd(\Session::has('tempuser.token'));
throw new AuthCheckException('base', 'invalid session');
}
}
示例7: getLogout
public function getLogout()
{
if (\Session::has('UserID')) {
\Session::forget('UserID');
}
$this->auth->logout();
return redirect(url('/user/login'));
}
示例8: error403
public function error403()
{
$error = null;
if (\Session::has('error')) {
$error = \Session::get('error');
}
return response(view("errors.403", compact('error')), 403);
}
示例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');
}
示例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"));
}
}
示例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');
}
}
示例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);
}
示例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);
}
示例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";
// }
}
}
示例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個の間で指定してください。']);
}