本文整理汇总了PHP中RainLab\User\Models\User::whereHas方法的典型用法代码示例。如果您正苦于以下问题:PHP User::whereHas方法的具体用法?PHP User::whereHas怎么用?PHP User::whereHas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RainLab\User\Models\User
的用法示例。
在下文中一共展示了User::whereHas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onReport
public function onReport()
{
if (!Auth::check()) {
throw new ApplicationException('You must be logged in to perform this action!');
}
Flash::success(post('flash', 'User has been reported for spamming, thank-you for your assistance!'));
$moderators = UserModel::whereHas('forum_member', function ($member) {
$member->where('is_moderator', true);
})->lists('name', 'email');
if ($moderators) {
$member = $this->getMember();
$memberUrl = $this->currentPageUrl(['slug' => $member->slug]);
$otherMember = $this->getOtherMember();
$otherMemberUrl = $this->currentPageUrl(['slug' => $otherMember->slug]);
$params = ['member' => $member, 'memberUrl' => $memberUrl, 'otherMember' => $otherMember, 'otherMemberUrl' => $otherMemberUrl];
Mail::sendTo($moderators, 'rainlab.forum::mail.member_report', $params);
}
return $this->redirectToSelf();
}