/** * Get the height for a tide at a given hour. * * @param Carbon $hour * @param string $tz * @param string $stationId * @return array */ public function getHeightAtHour(Carbon $hour, $tz, $stationId) : array { $tideBeforeStart = TideData::select('height', 'timestamp') ->where('timestamp', '<=', $hour) ->where('noaa_station_id', $stationId) ->orderBy('timestamp', 'desc') ->first()->toArray(); $tideAfterStart = TideData::select('height', 'timestamp') ->where('timestamp', '>=', $hour) ->where('noaa_station_id', $stationId) ->orderBy('timestamp', 'asc') ->first()->toArray(); $height = $this->getTideHeight( $tideBeforeStart['timestamp'], $tideBeforeStart['height'], $tideAfterStart['timestamp'], $tideAfterStart['height'], $hour ); $direction = $tideBeforeStart < $tideAfterStart ? 'rising' : 'falling'; $data = [ 'time_utc' => $hour->copy()->format('g:i A'), 'time_local' => $hour->copy()->setTimezone($tz)->format('g:i A'), 'height' => round($height, 2), 'direction' => $direction, ]; return $data;
"Call to a member function toArray() on null"
Key | Value |
USER | "www-data"
|
HOME | "/var/www"
|
HTTP_HOST | "surf.alexnordlinger.com"
|
HTTP_REFERER | "http://surf.alexnordlinger.com/"
|
HTTP_USER_AGENT | "claudebot"
|
HTTP_ACCEPT | "*/*"
|
REDIRECT_STATUS | "200"
|
SERVER_NAME | "surf.alexnordlinger.com"
|
SERVER_PORT | "80"
|
SERVER_ADDR | "138.68.18.148"
|
REMOTE_PORT | "43412"
|
REMOTE_ADDR | "54.85.255.74"
|
SERVER_SOFTWARE | "nginx/1.10.3"
|
GATEWAY_INTERFACE | "CGI/1.1"
|
REQUEST_SCHEME | "http"
|
SERVER_PROTOCOL | "HTTP/1.1"
|
DOCUMENT_ROOT | "/var/www/swell/public"
|
DOCUMENT_URI | "/index.php"
|
REQUEST_URI | "/locations/malibu-1st-point"
|
SCRIPT_NAME | "/index.php"
|
CONTENT_LENGTH | "" |
CONTENT_TYPE | "" |
REQUEST_METHOD | "GET"
|
QUERY_STRING | "" |
SCRIPT_FILENAME | "/var/www/swell/public/index.php"
|
PATH_INFO | "" |
FCGI_ROLE | "RESPONDER"
|
PHP_SELF | "/index.php"
|
REQUEST_TIME_FLOAT | 1710825003.2999
|
REQUEST_TIME | 1710825003
|
APP_NAME | "Swell Diaries"
|
APP_ENV | "production"
|
APP_KEY | "base64:zfdw+q+0yzNSlEa5KLQENMrjQxfP9EN4ZzPQC3nObPU="
|
APP_DEBUG | "true"
|
APP_URL | "http://surf.alexnordlinger.com/"
|
LOG_CHANNEL | "stack"
|
DB_CONNECTION | "mysql"
|
DB_HOST | "127.0.0.1"
|
DB_PORT | "3306"
|
DB_DATABASE | "swell"
|
DB_USERNAME | "root"
|
DB_PASSWORD | "4jDupz12$"
|
BROADCAST_DRIVER | "log"
|
CACHE_DRIVER | "file"
|
SESSION_DRIVER | "file"
|
SESSION_LIFETIME | "120"
|
QUEUE_DRIVER | "sync"
|
REDIS_HOST | "127.0.0.1"
|
REDIS_PASSWORD | "null"
|
REDIS_PORT | "6379"
|
MAIL_DRIVER | "smtp"
|
MAIL_HOST | "smtp.mailtrap.io"
|
MAIL_PORT | "2525"
|
MAIL_USERNAME | "null"
|
MAIL_PASSWORD | "null"
|
MAIL_ENCRYPTION | "null"
|
PUSHER_APP_ID | "" |
PUSHER_APP_KEY | "" |
PUSHER_APP_SECRET | "" |
PUSHER_APP_CLUSTER | "mt1"
|
MIX_PUSHER_APP_KEY | "" |
MIX_PUSHER_APP_CLUSTER | "mt1"
|
BACKPACK_LICENSE | "free1318!dsurf831SHH8a881j"
|
BACKPACK_BASE_VERSION | "1.0.0"
|
BACKPACK_CRUD_VERSION | "3.5.1"
|
Key | Value |
APP_NAME | "Swell Diaries"
|
APP_ENV | "production"
|
APP_KEY | "base64:zfdw+q+0yzNSlEa5KLQENMrjQxfP9EN4ZzPQC3nObPU="
|
APP_DEBUG | "true"
|
APP_URL | "http://surf.alexnordlinger.com/"
|
LOG_CHANNEL | "stack"
|
DB_CONNECTION | "mysql"
|
DB_HOST | "127.0.0.1"
|
DB_PORT | "3306"
|
DB_DATABASE | "swell"
|
DB_USERNAME | "root"
|
DB_PASSWORD | "4jDupz12$"
|
BROADCAST_DRIVER | "log"
|
CACHE_DRIVER | "file"
|
SESSION_DRIVER | "file"
|
SESSION_LIFETIME | "120"
|
QUEUE_DRIVER | "sync"
|
REDIS_HOST | "127.0.0.1"
|
REDIS_PASSWORD | "null"
|
REDIS_PORT | "6379"
|
MAIL_DRIVER | "smtp"
|
MAIL_HOST | "smtp.mailtrap.io"
|
MAIL_PORT | "2525"
|
MAIL_USERNAME | "null"
|
MAIL_PASSWORD | "null"
|
MAIL_ENCRYPTION | "null"
|
PUSHER_APP_ID | "" |
PUSHER_APP_KEY | "" |
PUSHER_APP_SECRET | "" |
PUSHER_APP_CLUSTER | "mt1"
|
MIX_PUSHER_APP_KEY | "" |
MIX_PUSHER_APP_CLUSTER | "mt1"
|
BACKPACK_LICENSE | "free1318!dsurf831SHH8a881j"
|