本文整理汇总了PHP中Cookie::queue方法的典型用法代码示例。如果您正苦于以下问题:PHP Cookie::queue方法的具体用法?PHP Cookie::queue怎么用?PHP Cookie::queue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::queue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleCallback
public function handleCallback($driver, Request $req)
{
$socialuser = \Socialize::with($driver)->user();
$user = User::where('email', $socialuser->email)->first();
if (count($user) < 1) {
$user = new User();
$user->id = (string) Uuid::generate();
$user->email = $socialuser->email;
$user->name = $socialuser->name;
$user->avatar = $socialuser->avatar;
$user->save();
}
$user = \Auth::loginUsingId($user->id);
$authcookie = \Cookie::queue('authenticated', true, 20, null, "www.thinkmerit.in", false, false);
$username = \Cookie::queue('name', $user->name, 20, null, "www.thinkmerit.in", false, false);
$avatar = \Cookie::queue('avatar', $user->avatar, 20, null, "www.thinkmerit.in", false, false);
$email = \Cookie::queue('email', $user->email, 20, null, "www.thinkmerit.in", false, false);
if (app()->environment() == "production") {
return \Redirect::to("http://www.thinkmerit.in");
} else {
return \Redirect::to("http://www.dev.thinkmerit.in");
}
/* ->withCookie($authcookie)
->withCookie($username)
->withCookie($avatar)
->withCookie($email);*/
// ;
}
示例2: showRefLink
/**
* [showRefLink description]
* Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
*
* @param [text] $link [referral link]
*
* @return [json] [all info abou the link]
*/
public function showRefLink($link = null)
{
// // If it has a Sponsor Cookie
if (\Cookie::has('sponsor')) {
return Redirect::to('/');
// Load Referral Link View
}
if (is_null($link)) {
return Redirect::to('/');
// Redirect To HomePage
}
try {
// If has $Link then Look in Database if Exist
$link = Link::findByLink($link)->load('user.profile');
$link = $link->toArray();
// Note Cookie Wont Be Created if Exceeded More than 4kb
\Cookie::queue('sponsor', $link, 2628000);
// Return Referral View with Variable Link
return Redirect::to('/')->with('link', $link);
// If No Record Found Throw Exception!
} catch (ModelNotFoundException $e) {
// Return Back to Home
return Redirect::to('/');
// return view('nosponsor');
}
}
示例3: showHome
public function showHome()
{
if (Auth::check()) {
$user = Auth::user();
$data['username'] = preg_replace('/@.*?$/', '', $user->email);
$data['user'] = $user;
if (!is_null($user->provider()->first()) && $user->provider()->first()->provider == 'facebook') {
$data['avatar'] = '<img src="http://graph.facebook.com/' . $user->provider()->first()->provider_id . '/picture?type=small" alt="avatar" />';
}
}
$items = ['home-bg-1.jpg', 'home-bg-2.jpg', 'home-bg-3.jpg', 'home-bg-4.jpg', 'home-bg-5.jpg', 'home-bg-6.jpg', 'home-bg-7.jpg', 'home-bg-8.jpg', 'home-bg-9.jpg', 'home-bg-10.jpg', 'home-bg-12.jpg', 'home-bg-13.jpg', 'home-bg-14.jpg', 'home-bg-15.jpg', 'home-bg-16.jpg', 'home-bg-17.jpg', 'home-bg-18.jpg', 'home-bg-19.jpg', 'home-bg-20.jpg', 'home-bg-21.jpg', 'home-bg-22.jpg', 'home-bg-23.jpg', 'home-bg-24.jpg', 'home-bg-25.jpg', 'home-bg-26.jpg', 'home-bg-27.jpg', 'home-bg-28.jpg', 'home-bg-29.jpg', 'home-bg-30.jpg', 'home-bg-32.jpg', 'home-bg-33.jpg', 'home-bg-34.jpg'];
$data['introImg'] = $items[array_rand($items)];
$lastMonth = Carbon::now()->subMonth();
$popular = Stat::where('created_at', '>=', $lastMonth)->orderBy('hits', 'desc')->take(3)->get();
$data['popularHashtags'] = [];
foreach ($popular as $post) {
$hashtag = $post->board()->first()->hashtag;
if ($post->board()->first()->config()->first()->user_id == 0) {
$url = $hashtag . '/szukaj';
} else {
$url = $hashtag . '/' . $post->board()->first()->id;
}
$href = '<a class="hashtag" href="' . URL::to('/') . '/' . $url . '">#' . $hashtag . '</a>';
array_push($data['popularHashtags'], $href);
}
$data['title'] = $this->layout->title = null;
$cookie = Cookie::queue('cookie_accept', 'yes', 2628000);
$this->layout->content = View::make('front.home', $data);
}
示例4: getIndex
public function getIndex()
{
// ref
\Cookie::queue('referrer', Input::get('ref'));
// abtesting
$this->data['abFirstStepForm'] = Input::get('v') == 2 ? true : \Config::get('unflare.abtesting.firstStepForm');
return $this->render('web.root');
}
示例5: doChangeLocale
public function doChangeLocale()
{
$locale = Input::get('locale');
LaravelLocalization::setLocale($locale);
App::setLocale($locale);
Cookie::queue('locale', $locale);
return Response::json(array('status' => true, 'link' => geturl(Input::get('url'))));
}
示例6: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('hardywen/cookie-csrf');
$config = $this->app->config->get('cookie-csrf::config');
//根据config配置哪些route及提交方法需要调用cookie-csrf
$this->app->router->when('*', 'cookie-csrf', $config['method']);
//将csrf token 放进 cookie里
\Cookie::queue('cookie_csrf_token', csrf_token());
}
示例7: views_cookie
/**
* 文章瀏覽數
*
*/
public static function views_cookie($type, $id)
{
$key = $type . '_' . $id;
if (Cookie::get($key)) {
return false;
}
Cookie::queue($key, 1, 5);
return true;
}
示例8: index
public function index()
{
if (\Input::get('theme')) {
\Cookie::queue('theme', \Input::get('theme'), 100);
return Redirect::to('/')->withCookie(cookie('theme', \Input::get('theme'), 100));
}
$data = array('videos' => Video::where('active', '=', '1')->orderBy('created_at', 'DESC')->simplePaginate($this->videos_per_page), 'current_page' => 1, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/videos', 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
//dd($data['videos']);
return View::make('Theme::home', $data);
}
示例9: getLogin
public function getLogin($id)
{
$curl = new Acme\Repositories\Curl();
$result = json_decode($curl->postToken($id, 1234, 'http://app' . $id . '.dev/login/' . $id, Input::get('code')));
if (isset($result->access_token)) {
Cookie::queue('access_token', $result->access_token, $result->expires_in / 60);
} else {
Cookie::queue('access_token', null);
}
return Redirect::to('/')->with(Input::all());
}
示例10: create
/**
* View Login page
* @return [type] [description]
*/
public function create()
{
if (Auth::check()) {
return Redirect::intended('/');
}
$cookies = Cookie::get();
foreach ($cookies as $name => $cookie) {
Cookie::queue(Cookie::forget($name));
}
return View::make('login');
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param Requests\Frontend\StoreCommentRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Requests\Frontend\StoreCommentRequest $request)
{
if ($comment = Comment::create($request->all())) {
\Session::flash('comment.success', '评论发布成功, 审核通过即可显示');
\Cookie::queue('comment_url', $comment->url);
\Cookie::queue('comment_email', $comment->email);
\Cookie::queue('comment_nickname', $comment->nickname);
return back();
}
\Session::flash('comment.fail', '评论发布失败');
return back()->withInput();
}
示例12: postIndex
public function postIndex()
{
$vars = array('class' => 'CRP', 'level' => 5, 'craftable_only' => 0, 'slim_mode' => 0, 'rewardable_too' => 0);
$values = array();
foreach ($vars as $var => $default) {
$values[] = Input::has($var) ? Input::get($var) : $default;
}
$url = '/equipment/list?' . implode(':', $values);
// Queueing the cookie, we won't need it right away, so it'll save for the next Response::
Cookie::queue('previous_equipment_load', $url, 525600);
// 1 year's worth of minutes
return Redirect::to($url);
}
示例13: removeTTN
public function removeTTN()
{
$id = Input::get('id');
if (!$id) {
throw new RuntimeException();
}
$idsCookie = Cookie::get('zd_ttn_numbers');
if (($key = array_search($id, $idsCookie)) !== false) {
unset($idsCookie[$key]);
}
Cookie::queue('zd_ttn_numbers', $idsCookie, Settings::get('cookie_save_time'));
return Response::json(array('status' => true));
}
示例14: index
public function index()
{
$map_units = array();
//$map_units[] = (new MapUnit('53.076455,82.357315'))->getLatLon();
//$map_units[] = (new GPRMCUnit('$GPRMC,123347.000,A,4313.7477,N,02752.4516,E,0.00,284.40,080811,,,D*63'))->getLatLon();
$comet_token = Auth::user()->createCometToken();
Cookie::queue('comet_token', $comet_token);
$map_units = MapUnit::all()->toArray();
View::share('page_key', 'home');
View::share('page_title', 'Test');
$this->layout->header = View::make('header');
$this->layout->map_part = View::make('show-map');
$this->layout->map_part->map_units = $map_units;
}
示例15: postProjectsSort
public function postProjectsSort($param)
{
$lang = Cookie::get('lang', 'ru');
$sort = Cookie::get("sort_{$param}", 'ASC');
$load = Input::get('load');
$projects = Project::select('project_id', 'project_alias', "project_keywords_{$lang}", "project_description_{$lang}", "project_name_{$lang}", "project_text_{$lang}", "project_image_preview", "project_date_start", "project_date_stop", "updated_at")->orderBy($param, $sort)->limit($load)->get();
$projects_count = Project::count();
if ($sort == 'ASC') {
Cookie::queue("sort_{$param}", 'DESC');
} else {
Cookie::queue("sort_{$param}", 'ASC');
}
$tpl = View::make('layouts.projects')->with(array('projects' => $projects, 'projects_count' => $projects_count, 'lang' => $lang))->render();
return Response::json(array('success' => true, 'status' => 200, 'tpl' => $tpl, 'param' => $param, 'sort' => $sort));
}