本文整理汇总了PHP中app\Auth::guest方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::guest方法的具体用法?PHP Auth::guest怎么用?PHP Auth::guest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Auth
的用法示例。
在下文中一共展示了Auth::guest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unReadCount
public function unReadCount()
{
if (\Auth::guest()) {
return 0;
}
if ($this->userReadDiscussion->count() > 0) {
return $this->total_comments - $this->userReadDiscussion->first()->read_comments;
}
return $this->total_comments;
}
示例2: getCompletedAttribute
/**
* @todo this is fucking gross
*/
public function getCompletedAttribute()
{
if (\Auth::guest()) {
return false;
}
$entry = Entry::where('goal_id', $this->id)->where('user_id', \Auth::user()->id)->where('completed_on', Carbon::today())->first();
if ($entry) {
return true;
}
return false;
}
示例3: checkFavorite
/**
* Check whether this article got favor by logged in user or not
*
* @return boolen
*/
public function checkFavorite()
{
if (\Auth::guest()) {
return false;
} else {
if ($this->favorites()->where('id', \Auth::user()->id)->first() === NULL) {
return false;
} else {
return true;
}
}
}
示例4: isProjectAdmin
/**
* Check if user is a admin of this project
*
* @return boolean
*/
public function isProjectAdmin($user_id = null)
{
if (!Auth::guest()) {
if ($user_id == null) {
$user_id = Auth::user()->id;
}
$isAdmin = ProjectMember::where('user_id', '=', $user_id)->where('project_id', '=', $this->id)->first();
if ($isAdmin != null) {
$isAdmin = true;
} else {
$isAdmin = false;
}
} else {
$isAdmin = false;
}
return $isAdmin;
}
示例5: checkFollow
public function checkFollow()
{
if (\Auth::guest()) {
return false;
} else {
if ($this->followedUsers()->where('id', \Auth::user()->id)->first() === NULL) {
return false;
} else {
return true;
}
}
}