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


PHP Auth::isAccessingSelf方法代码示例

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


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

示例1: get

 public function get($username = null)
 {
     $user = User::where('username', $username)->with(['awards', 'objects', 'notes', 'favorites', 'notifications.notificationType'])->firstOrFail();
     $params = ['user' => $user, 'favoriteMission' => $user->profile->favoriteMission, 'objects' => $user->objects()->authedVisibility()->take(10), 'favorites' => $user->favorites->take(10), 'comments' => $user->comments->take(10), 'deltaV' => $user->totalDeltaV(), 'subscriptionExtendedBy' => $user->subscriptionExtendedBy(true)];
     // If the requesting user is logged in & if the requesting user is requesting themselves
     if (Auth::isAccessingSelf($user)) {
         $params['notes'] = $user->notes->take(10);
         // Fetch the status of their interactions
         $params['interactions'] = ['Favorite Mission' => $user->profile->favorite_mission != null, 'Favorite Patch' => $user->profile->favorite_mission_patch != null, 'SMS Messages' => $user->notifications->filter(function ($notification) {
             return in_array($notification->notification_type_id, [NotificationType::TMinus24HoursSMS, NotificationType::TMinus3HoursSMS, NotificationType::TMinus1HourSMS]);
         })->count() == 1, 'Countdown Emails' => $user->notifications->filter(function ($notification) {
             return in_array($notification->notification_type_id, [NotificationType::TMinus1HourEmail, NotificationType::TMinus3HoursEmail, NotificationType::TMinus24HoursEmail]);
         })->count() > 0, 'Launch Update Emails' => $user->notifications->filter(function ($notification) {
             return $notification->notification_type_id == NotificationType::LaunchChange;
         })->count() == 1, 'News Summaries' => $user->notifications->filter(function ($notification) {
             return $notification->notification_type_id == NotificationType::NewsSummaries;
         })->count() == 1];
     }
     return view('users.profile', $params);
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:20,代码来源:UsersController.php


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