本文整理匯總了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;
}
}
}