本文整理汇总了PHP中Illuminate\Support\Facades\Session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::get方法的具体用法?PHP Session::get怎么用?PHP Session::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Session
的用法示例。
在下文中一共展示了Session::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!Session::get('has_access')) {
return redirect('/auth');
}
return $next($request);
}
示例2: showNews
/**
* @return mixed
*/
public function showNews()
{
$slug = Request::segment(2);
$news_title = "Not active";
$news_text = "Either this news item is not active, or it does not exist";
$active = 1;
$news_id = 0;
$results = DB::table('news')->where('slug', '=', $slug)->get();
foreach ($results as $result) {
$active = $result->active;
if ($active > 0 || Auth::check() && Auth::user()->hasRole('news')) {
if (Session::get('lang') == null || Session::get('lang') == "en") {
$news_title = $result->title;
$news_text = $result->news_text;
$news_id = $result->id;
} else {
$news_title = $result->title_fr;
$news_text = $result->news_text_fr;
$news_id = $result->id;
}
$news_image = $result->image;
$news_date = $result->news_date;
}
}
return View::make('public.news')->with('news_title', $news_title)->with('news_text', $news_text)->with('page_content', $news_text)->with('active', $active)->with('news_id', $news_id)->with('news_date', $news_date)->with('news_image', $news_image)->with('menu', $this->menu)->with('page_category_id', 0)->with('page_title', $news_title);
}
示例3: getCart
/**
* @return Cart
*/
private function getCart()
{
if (Session::get('cart')) {
return Session::get('cart');
}
return $this->cart;
}
示例4: postSendsms
public function postSendsms(Request $request)
{
$mobile = Input::get('mobile');
if (!preg_match("/1[3458]{1}\\d{9}\$/", $mobile)) {
// if(!preg_match("/^13\d{9}$|^14\d{9}$|^15\d{9}$|^17\d{9}$|^18\d{9}$/",$mobile)){
//手机号码格式不对
return parent::returnJson(1, "手机号码格式不对" . $mobile);
}
$data = DB::select("select * from members where lifestatus=1 and mobile =" . $mobile);
if (sizeof($data) > 0) {
return parent::returnJson(1, "手机号已注册");
}
$checkCode = parent::get_code(6, 1);
Session::put("m" . $mobile, $checkCode);
$checkCode = Session::get("m" . $mobile);
Log::error("sendsms:session:" . $checkCode);
$msg = "尊敬的用户:" . $checkCode . "是您本次的短信验证码,5分钟内有效.";
// Input::get('msg');
$curl = new cURL();
$serverUrl = "http://cf.lmobile.cn/submitdata/Service.asmx/g_Submit";
$response = $curl->get($serverUrl . "?sname=dlrmcf58&spwd=ZRB2aP8K&scorpid=&sprdid=1012818&sdst=" . $mobile . "&smsg=" . rawurlencode($msg . "【投贷宝】"));
$xml = simplexml_load_string($response);
echo json_encode($xml);
//$xml->State;
// <CSubmitState xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
// <State>0</State>
// <MsgID>1512191953407413801</MsgID>
// <MsgState>提交成功</MsgState>
// <Reserve>0</Reserve>
// </CSubmitState>
// <State>1023</State>
// <MsgID>0</MsgID>
// <MsgState>无效计费条数,号码不规则,过滤[1:186019249011,]</MsgState>
// <Reserve>0</Reserve>
}
示例5: 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());
}
示例6: __construct
public function __construct($method, array $fields = [], array $options = [], $url = null, $assoc = false)
{
if ($url) {
$this->url = $url;
}
$this->url .= $method;
$this->ch = curl_init($this->url);
if (!$this->ch) {
throw new Exception('Curl initialisation failed!');
}
$this->defaultFields['access_token'] = Session::get('vk_token');
$options[CURLOPT_POSTFIELDS] = http_build_query(array_replace($this->defaultFields, $fields));
$this->options = array_replace($this->defaults, $options);
if (!curl_setopt_array($this->ch, $this->options)) {
throw new Exception('Curl options setting failed!');
}
$this->results = json_decode(curl_exec($this->ch), $assoc);
if (!$this->results) {
throw new Exception('Curl exec failed');
}
if (isset($this->results->error)) {
throw new Exception($this->results->error->error_code . ': ' . $this->results->error->error_msg, $this->results->error->error_code);
}
curl_close($this->ch);
}
示例7: markAcceptance
public function markAcceptance($policyCode, $userUid)
{
// get inputs
//
$policy = Policy::where('policy_code', '=', $policyCode)->first();
$user = User::getIndex($userUid);
$acceptFlag = Input::has('accept_flag');
// check inputs
//
if (!$user || !$policy || !$acceptFlag) {
return Response::make('Invalid input.', 404);
}
// check privileges
//
if (!$user->isAdmin() && $user->user_uid != Session::get('user_uid')) {
return Response::make('Insufficient privileges to mark policy acceptance.', 401);
}
// get or create new user policy
//
$userPolicy = UserPolicy::where('user_uid', '=', $userUid)->where('policy_code', '=', $policyCode)->first();
if (!$userPolicy) {
$userPolicy = new UserPolicy(array('user_policy_uid' => GUID::create(), 'user_uid' => $userUid, 'policy_code' => $policyCode));
}
$userPolicy->accept_flag = $acceptFlag;
$userPolicy->save();
return $userPolicy;
}
示例8: pubpriv
/**
* @return mixed
*/
public function pubpriv()
{
/**
* Verify CSRF token.
*/
if ($_POST['_token'] !== Session::token()) {
return Response::json(array('error' => true));
}
/**
* Session validation
*/
$session = Session::get('uber_profile');
if (!isset($session) || $session['utid'] !== $_POST['utid']) {
return Response::json(array('error' => true));
}
/**
* Find Uber row and change public/private status.
*/
$uber = Uber::where('utid', $_POST['utid'])->first();
$status = $_POST['status'] == 1 ? false : true;
$uber->public = $status;
$uber->save();
/**
* Respond with json success data.
*/
return Response::json(array('success' => true, 'dump' => $uber->public));
}
示例9: isLoggedIn
public function isLoggedIn()
{
if (Session::has('token')) {
$this->client->setAccessToken(Session::get('token'));
}
return $this->client->getAccessToken();
}
示例10: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
if (Session::has('user_instagram_info')) {
$userInfo = Session::get('user_instagram_info');
return view('dashboard.customerRegister', ['userInfo' => $userInfo]);
}
}
示例11: get
/**
* Returns session data
*
* @static
* @param string $key
* @return array
*/
public static function get($key)
{
if (!isset(static::$cache[$key])) {
static::$cache[$key] = parent::get($key);
}
return static::$cache[$key];
}
示例12: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Session::get('Email') != 'astral') {
return redirect('/adminC');
}
return $next($request);
}
示例13: isAuthorSession
public function isAuthorSession()
{
if (Session::get('ROLE.Author')) {
return true;
}
return false;
}
示例14: addMedicalRecordCreate
public function addMedicalRecordCreate()
{
$validator = Validator::make(Input::all(), array('HN' => 'min:8|hn_exist|have_appointment_with_me|already_addmedicalrecord'), array('HN.min' => 'ท่านกรอก HN ของผู้ป่วยไม่ครบ', 'HN.hn_exist' => 'HN ที่ท่านกรอกไม่ตรงกับผู้ป่วยใดของโรงพยาบาล', 'HN.have_appointment_with_me' => 'ผู้ป่วยคนนี้ไม่ได้นัดกับท่านไว้ในช่วงเวลานี้', 'HN.already_addmedicalrecord' => 'ท่านได้ทำการบันทึกการรักษาผู้ป่วยคนนี้ไปแล้ว'));
if ($validator->passes()) {
$n = Input::get('ICD10');
$diseases = DB::table('ICD10_Disease')->get();
$i = 0;
foreach ($diseases as $disease) {
if ($i++ == $n) {
$ICD10 = $disease->ICD10;
break;
}
}
date_default_timezone_set('Asia/Bangkok');
$date = date("Y-m-d", time());
$time = date("H:i:s", time());
$morning = 1;
if ((int) date("H", time()) < 12) {
$morning = 0;
}
DB::table('appointments')->where('HN', Input::get('HN'))->where('appointmentDate', $date)->where('morning', $morning)->update(array('addMedicalRecordTime' => $time));
$addMedicalRecord = new MedicalRecord();
$addMedicalRecord->HN = Input::get('HN');
$addMedicalRecord->doctorEmpID = Session::get('username');
date_default_timezone_set('Asia/Bangkok');
$addMedicalRecord->date = $date;
$addMedicalRecord->time = $time;
$addMedicalRecord->symptom = Input::get('symptom');
$addMedicalRecord->ICD10 = $ICD10;
$addMedicalRecord->save();
return Redirect::to('doctor/addMedicalRecord')->with('flash_notice', 'ดำเนินการบันทึกการรักษาสำเร็จ');
} else {
return Redirect::to('doctor/addMedicalRecord')->withErrors($validator)->withInput();
}
}
示例15: log
/**
* Create an activity log entry.
*
* @param mixed
* @return boolean
*/
public static function log($data = array())
{
if (is_object($data)) {
$data = (array) $data;
}
if (is_string($data)) {
$data = array('action' => $data);
}
$user = Auth::user();
$activity = new static();
$activity->user_id = isset($user->id) ? $user->id : 0;
$activity->content_id = isset($data['contentID']) ? $data['contentID'] : 0;
$activity->content_type = isset($data['contentType']) ? $data['contentType'] : "";
$activity->action = isset($data['action']) ? $data['action'] : "";
$activity->description = isset($data['description']) ? $data['description'] : "";
$activity->details = isset($data['details']) ? $data['details'] : "";
//set action and allow "updated" boolean to replace activity text "Added" or "Created" with "Updated"
if (isset($data['updated'])) {
if ($data['updated']) {
$activity->description = str_replace('Added', 'Updated', str_replace('Created', 'Updated', $activity->description));
$activity->action = "Updated";
} else {
$activity->action = "Created";
}
}
if (isset($data['deleted']) && $data['deleted']) {
$activity->action = "Deleted";
}
//set developer flag
$activity->developer = !is_null(Session::get('developer')) ? true : false;
$activity->ip_address = Request::getClientIp();
$activity->user_agent = $_SERVER['HTTP_USER_AGENT'];
$activity->save();
return true;
}