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


PHP Session::has方法代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request and check for playerId in the session
  * If it cannot be found it will redirect the the URL in the config
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Session::has('email')) {
         return $next($request);
     }
     return redirect('/' . config('sol.loginUrl', 'sollogin'));
 }
开发者ID:koter84,项目名称:laravel-sol,代码行数:15,代码来源:SolLogin.php

示例2: __construct

 /**
  * The constructor searches for an already set locale. If none is found, set the default locale.
  */
 public function __construct()
 {
     if (!Session::has('locale')) {
         Session::put('locale', $this->languages[0]);
     }
     app()->setLocale(Session::get('locale'));
 }
开发者ID:lartificer,项目名称:news,代码行数:10,代码来源:NewsController.php

示例3: set

 public function set($key, $value)
 {
     if (!Session::has($this->namespace)) {
         $this->clear();
     }
     Session::put($this->namespace . '.' . $key, $value);
 }
开发者ID:metrakit,项目名称:visualcaptcha-laravel,代码行数:7,代码来源:SessionCaptcha.php

示例4: handle

 /**
  * @param Request $request
  * @param Closure $next
  */
 public function handle($request, Closure $next)
 {
     Lang::setFallback(self::getDefault());
     $setLocale = Session::get('setLocale');
     //flash data
     if (Config::get('app.locale_use_cookie')) {
         if ($setLocale) {
             Session::set('locale', $setLocale);
         }
         if (Session::has('locale')) {
             App::setLocale(Session::get('locale'));
         } else {
             self::autoDetect();
         }
     } else {
         if (Config::get('app.locale_use_url')) {
             if ($setLocale) {
                 self::setLocaleURLSegment($setLocale);
             } else {
                 $lang = self::getLocaleFromURL();
                 if ($lang) {
                     App::setLocale($lang);
                 } else {
                     if ($request->segment(1) != 'locale') {
                         //ignore set-locale URL
                         self::autoDetect();
                         self::setLocaleURLSegment(self::get());
                     }
                 }
             }
         }
     }
     View::share('lang', self::get());
 }
开发者ID:hramose,项目名称:laravel5-adminLTE-1,代码行数:38,代码来源:language.php

示例5: register

 public function register(Request $request)
 {
     if (Session::has('ror_user')) {
         return redirect('/');
     }
     if ($request->isMethod('post')) {
         try {
             $objModelUsers = User::getInstance();
             $data = array('email' => $request['email'], 'password' => Hash::make($request['signUpPassword']), 'report_login_active' => 1, 'business_login_active' => 1, 'role' => 0);
             $user = $objModelUsers->addNewUser($data);
             if ($user) {
                 $userDetails = $objModelUsers->getUserById($user);
                 $userMetaData['user_id'] = $userDetails['original']['id'];
                 $userMetaData['full_name'] = $request->input('full_name');
                 $objModelUserMeta = new Usersmeta();
                 $usermetaDetails = $objModelUserMeta->InsertUserMeta($userMetaData);
                 if ($usermetaDetails) {
                     return redirect()->intended('/login');
                 } else {
                     return view("User/Views/user/login")->withErrors(['registerErrMsg' => 'Something went wrong, please try again.']);
                 }
             } else {
                 return view("User/Views/user/register")->withErrors(['registerErrMsg' => 'Something went wrong, please try again.']);
             }
         } catch (\Exception $ex) {
             return redirect()->back()->with('exception', 'An exception occurred, please reload the page and try again.');
         }
     }
     return view("User/Views/user/register");
 }
开发者ID:sumitglobussoft,项目名称:ROR,代码行数:30,代码来源:UserController.php

示例6: isLoggedIn

 /**
  * Check if user logged in or not
  *
  * @return bool
  */
 public function isLoggedIn()
 {
     if (Session::has('user_auth')) {
         return true;
     }
     return false;
 }
开发者ID:younginnovations,项目名称:resourcecontracts-country-subsite,代码行数:12,代码来源:AuthService.php

示例7: place

 public function place(Order $orderModel, OrderItem $orderItem)
 {
     //Método plcae order, quando acessar esse método ele ira acessar o carrinho de comprar e começar a executar
     //os pedidos
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     // recupera o carrinho de compras
     if ($cart->getTotal() > 0) {
         //Order retorna um id que será o código da ORDER
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         /*Método all corresponde ao método da classe Cart*/
         foreach ($cart->all() as $k => $item) {
             //Toda vez que der o save tem que passar a instancia lá para dentro
             $order->itens()->create(['product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
         }
         // Para limpar o carrinho de compras
         $cart->clear();
         // Evento Checkout
         // Precisa passar o usuario, nome, order itens do pedido
         event(new CheckoutEvent(Auth::user(), $order));
         //event(new CheckoutEvent());
         return view('store.checkout', compact('order', 'cart'));
     }
     $categories = Category::all();
     return view('store.checkout', ['cart' => 'empty', 'categories' => $categories]);
 }
开发者ID:GabrielApG,项目名称:CodeCommerce,代码行数:28,代码来源:CheckoutController.php

示例8: __construct

 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct(Request $r)
 {
     date_default_timezone_set("Asia/Jakarta");
     //$this->middleware('auth');
     //echo "<pre>".print_r($_SERVER,1)."</pre>";
     $log = new Logdata();
     $log->idpengguna = Auth::check() ? Auth::user()->id : 0;
     $log->url = $r->url();
     $log->user_agent = $_SERVER['HTTP_USER_AGENT'];
     $log->ip = $_SERVER['REMOTE_ADDR'];
     $log->ip_port = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : "";
     $log->http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "";
     $log->http_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "";
     $log->pathinfo = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
     $log->save();
     // echo Auth::user()->password;
     // if(Auth::check()){
     // 	if(Auth::user()->password==""){
     // 		header("location:".url('notfound'));
     // 		die();
     // 	}
     // }
     //		Session::put("a-".getenv('REMOTE_ADDR')."-3",'x');
     foreach (\App\Popups::all() as $key) {
         $isi = array();
         if ($key->tipe_valid == "by_datetime" or $key->tipe_valid == "by_date") {
             $cek = $this->check_in_range(date_format(date_create($key->date_valid_start . " " . $key->time_valid_start), "Y-m-d H:i:s"), date_format(date_create($key->date_valid_end . " " . $key->time_valid_end), "Y-m-d H:i:s"), date("Y-m-d H:i:s"));
             if ($cek) {
                 if (!Session::has("a-" . getenv('REMOTE_ADDR') . "-" . $key->id)) {
                     Session::put("a-" . getenv('REMOTE_ADDR') . "-" . $key->id, 'x');
                 }
             }
         }
     }
 }
开发者ID:ariefsetya,项目名称:it-club,代码行数:40,代码来源:HomeController.php

示例9: get_user

/**
 * Get the user object from the session
 * @return mixed|null
 */
function get_user()
{
    if (!Session::has("user")) {
        return null;
    }
    return Session::get("user");
}
开发者ID:sonarsoftware,项目名称:customer_portal,代码行数:11,代码来源:functions.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!(Session::has('user') && Session::get('user') == 'admin')) {
         return Redirect::to('/auth');
     }
     return $next($request);
 }
开发者ID:Germey,项目名称:GermyGallery,代码行数:14,代码来源:AdminMiddleware.php

示例11: place_order

 public function place_order(Order $orderModel, OrderItems $orderItems, CheckoutService $checkoutService)
 {
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     $categories = Category::all();
     if ($cart->getTotal() > 0) {
         $order = $orderModel::create(['user_id' => Auth::User()->id, 'total' => $cart->getTotal(), 'status' => '0']);
         foreach ($cart->all() as $id => $item) {
             $order->items()->create(['order_id' => $order->id, 'product_id' => $id, 'price' => $item['price'], 'qtd' => $item['qtd']]);
         }
         $checkout = $checkoutService->createCheckoutBuilder();
         $checkout->setReference($order->id);
         foreach ($order->items as $order_item) {
             $checkout->addItem(new Item($order_item->product_id, $order_item->product->name, $order_item->price));
         }
         $response = $checkoutService->checkout($checkout->getCheckout());
         $order->update(['payment_code' => $response->getCode()]);
         event(new CheckoutEvent($order, Auth::user()));
         $cart->clear();
         return redirect($response->getRedirectionUrl());
         //return view('checkout.place_order', ['order'=>$order, 'cart'=>'saved', 'categories'=>$categories]);
     }
     return view('checkout.place_order', ['cart' => 'empty', 'categories' => $categories]);
 }
开发者ID:mborgesmartins,项目名称:lcodecommerce,代码行数:26,代码来源:CheckoutController.php

示例12: upload

 /**
  * @param Request $request
  * @Post("/gallery/upload")
  * @Patch("/gallery/upload")
  */
 public function upload(Request $request)
 {
     if (!Session::has('gallery_hash')) {
         Session::put('gallery_hash', md5(time()));
     }
     return Response::json(['attachment' => ImageUploadFacade::attachmentUpload($request->file('upl'), new GalleryAttachment(), 'gallery', true)]);
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:12,代码来源:AdminGalleryController.php

示例13: place

 public function place(Order $orderModel, OrderItem $ordemItem, CheckoutService $checkoutService)
 {
     if (!Session::has('cart')) {
         return "FALSE";
     }
     $cart = Session::get('cart');
     $categories = Category::all();
     if ($cart->getTotal() > 0) {
         $checkout = $checkoutService->createCheckoutBuilder();
         //pagseguro
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         //inclui na tabela
         foreach ($cart->all() as $k => $item) {
             $checkout->addItem(new Item($k, $item['name'], number_format($item['price'], 2, ".", ""), $item['qtd']));
             //pagseguro
             $order->items()->create(['product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
             //inclui na tabela
         }
         $cart->clear();
         event(new CheckoutEvent(Auth::user(), $order));
         $response = $checkoutService->checkout($checkout->getCheckout());
         //pagseguro
         return redirect($response->getRedirectionUrl());
         //pagseguro
         #return view('store.checkout', compact('cart', 'order', 'categories'));
     } else {
         return view('store.checkout', ['cart' => 'empty', 'categories' => $categories]);
     }
 }
开发者ID:ecmattos,项目名称:codecommerce,代码行数:29,代码来源:CheckoutController.php

示例14: place

 public function place(Order $orderModel, Category $cat, CheckoutService $checkoutService)
 {
     if (!Session::has('cart')) {
         return false;
     }
     # bring all categories
     $categories = $cat->all();
     $cart = Session::get('cart');
     if ($cart->getTotal() > 0) {
         $checkoutBuilder = $checkoutService->createCheckoutBuilder();
         # create order
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         # insert items into this order
         foreach ($cart->all() as $id => $item) {
             $checkoutBuilder->addItem(new Item($item['num'], $item['name'], $item['price']));
             $order->items()->create(['product_id' => $id, 'price' => $item['price'], 'quantity' => $item['num']]);
         }
         # clear cart
         $cart->clear();
         # fire event (email) only if everything worked
         event(new CheckoutEvent(Auth::user(), $order));
         $checkout = $checkoutBuilder->getCheckout();
         $response = $checkoutService->checkout($checkout);
         # PagSeguro site redirect
         return redirect($response->getRedirectionUrl());
         //return view('store.checkout', compact('order', 'categories'));
     }
     return view('store.checkout', ['order' => null, 'categories' => $categories]);
 }
开发者ID:talvanes,项目名称:code-commerce,代码行数:29,代码来源:CheckoutController.php

示例15: checkQuiz

 public function checkQuiz()
 {
     if (Session::has('id') && (Session::get('type') === 'Student' || Session::get('type') === 'SuperAdmin')) {
         $input = Request::all();
         $correctAnswers = Session::get('correct_answer');
         $total_qus = Session::get('total_qus');
         $count = 0;
         foreach ($correctAnswers as $key => $value) {
             $k = 'q-' . $key;
             if (isset($input[$k]) && $input[$k] == $value) {
                 $count++;
             }
         }
         $marks = $count;
         $tot_marks = $total_qus;
         $s = $tot_marks - $marks;
         //echo $s;
         $result = new Result();
         $result->marks = $marks;
         $result->total_marks = $tot_marks;
         $result->unanswered = $s;
         $result->save();
         return View::make('result', array('result' => $result));
     } else {
         echo 'You are not authorized';
     }
 }
开发者ID:hramose,项目名称:MCQ-Test-using-Laravel-5.0,代码行数:27,代码来源:QuizController.php


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