本文整理汇总了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')]);
}
示例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);
}
}
}
示例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);
}
示例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']));
}
}