/** * Fetch a single user based on the value of a given column. * * For non-unique columns, it will return the first entry found. Returns false if no match is found. * @param value $value The value to find. * @param string $name The name of the column to match (defaults to id) * @return User */ public static function fetch($value, $name = "id") { if ($name == "id") { // Fetch by id return OAuthUser::find($value); } else { // Fetch by some other column name return OAuthUser::where($name, $value)->first(); } }