public function hasLiked() { if (!\Auth::check()) { return false; } return app('App\\Repositories\\LikeRepository')->hasLiked('comment', $this->id, \Auth::user()->id); }
/** * gets the user id of the current user * @return mixed */ public static function userId() { if (Auth::check()) { return Auth::user()->user_id; } else { return 0; } }
public function isOwner() { if (!\Auth::check()) { return false; } if (\Auth::user()->id == $this->user_id) { return true; } return false; }
public static function isSuperAdmin() { if (\Auth::check()) { if (\Auth::user()->role_id == 1) { return true; } return false; } return false; }
public static function generate() { if (!\Auth::check()) { return NULL; } $apiKey = new ApiKey(); $apiKey->user_id = \Auth::user()->id; $apiKey->api_key = \App\Helpers\Text::randomCryptoString(); $apiKey->save(); return $apiKey; }
public function isOwner($userid = null) { if (!\Auth::check()) { return false; } $userid = empty($userid) ? \Auth::user()->id : $userid; if ($this->user_id == $userid) { return true; } return false; }
public function scopeUserUnread($query, $uid = false) { $uid = $uid == false && \Auth::check() ? \Auth::user()->id : $uid; return $query->whereRaw("recipient_id = {$uid} AND unread = 1"); }
public function scopeFilters($query) { switch (Request::input('filter')) { case 'qualified': $filter = static::QUALIFIED; break; case 'ranked': $filter = static::RANKED; break; case 'approved': $filter = static::APPROVED; break; case 'modreq': case 'pending': $filter = static::PENDING; break; case 'all': return $query; case 'graveyard': $filter = static::GRAVEYARD; break; case 'my-maps': if (Auth::check()) { return $query->where('user_id', '=', Auth::user()->user_id); } case 'faves': return $query->faves(); case 'ranked-approved': default: return $query->whereIn('approved', [static::RANKED, static::APPROVED]); } return $query->where('approved', '=', $filter); }
/** * Easy method to check if the login user is the owner of this user * * @return boolean */ public function isOwner() { return \Auth::check() and \Auth::user()->id == $this->id; }
public function scopeFilters($query) { switch (Request::input("filter")) { case "qualified": $filter = static::QUALIFIED; break; case "ranked": $filter = static::RANKED; break; case "approved": $filter = static::APPROVED; break; case "modreq": case "pending": $filter = static::PENDING; break; case "all": return $query; case "graveyard": $filter = static::GRAVEYARD; break; case "my-maps": if (Auth::check()) { return $query->where("user_id", "=", Auth::user()->user_id); } case "faves": return $query->faves(); case "ranked-approved": default: return $query->whereIn("approved", [static::RANKED, static::APPROVED]); } return $query->where("approved", "=", $filter); }