예제 #1
0
 /**
  * Get the ID of a user with the given username.
  *
  * @param  string  $username
  * @param  \Flarum\Core\Models\User  $user
  * @return integer|null
  */
 public function getIdForUsername($username, User $user = null)
 {
     $query = User::where('username', 'like', $username);
     return $this->scopeVisibleForUser($query, $user)->pluck('id');
 }