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