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


PHP Auth::isSubscriber方法代码示例

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


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

示例1: about

 public function about()
 {
     if (Auth::isSubscriber()) {
         return redirect('/missioncontrol');
     }
     return view('missionControl.about', ['stripePublicKey' => Config::get('services.stripe.public')]);
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:7,代码来源:MissionControlController.php

示例2: incrementViewCounter

 public function incrementViewCounter()
 {
     // Only increment the view counter if the current user is a subscriber
     if (Auth::isSubscriber()) {
         $modelName = (new ReflectionClass($this))->getShortName();
         $modelKey = strtolower($modelName) . '_id';
         // Only increment the view counter if the user has not visited in 1 hour
         if (!Redis::exists($modelName . 'ViewByUser:' . $this->{$modelKey} . ':' . Auth::id())) {
             // Increment
             Redis::hincrby($modelName . ':' . $this->{$modelKey}, 'views', 1);
             // Add user to recent views
             Redis::setex($modelName . 'ViewByUser:' . $this->{$modelKey} . ':' . Auth::id(), 3600, true);
         }
     }
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:15,代码来源:CountsViewsTrait.php

示例3: favorite

 public function favorite($object_id)
 {
     if (Auth::isSubscriber()) {
         // Create Favorite
         if (request()->isMethod('post')) {
             if (Auth::user()->favorites()->count() == 0) {
                 Favorite::create(array('object_id' => $object_id, 'user_id' => Auth::id()));
             }
             // Delete Favorite
         } elseif (request()->isMethod('delete')) {
             Auth::user()->favorites()->where('object_id', $object_id)->firstOrFail()->delete();
         }
         Redis::sadd('objects:toReindex', $object_id);
         return response()->json(null, 204);
     }
     return response()->json(false, 401);
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:17,代码来源:ObjectsController.php

示例4: telemetry

 /**
  * GET (AJAX), /missions/{$slug}/telemetry. Fetches all mission telemetries for a specified mission,
  * ordered by the telemetry timestamp.
  *
  * @param $slug
  * @return \Illuminate\Http\JsonResponse
  */
 public function telemetry($slug)
 {
     $telemetryQuery = Telemetry::whereHas('mission', function ($q) use($slug) {
         $q->whereSlug($slug);
     })->orderBy('timestamp', 'ASC');
     if (Auth::isSubscriber()) {
         return response()->json($telemetryQuery->get());
     } else {
         return response()->json($telemetryQuery->get(['telemetry_id', 'timestamp', 'readout']));
     }
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:18,代码来源:MissionsController.php


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