'integer', 'expires_at' => 'datetime', 'last_visit' => 'datetime', 'date_created' => 'datetime', 'date_modified' => 'datetime' ]; public function restaurant() { return $this->belongsTo(Restaurant::class, 'tenant_id'); } /** * Check if the short URL has expired * * @return bool */ public function isExpired() { if (!$this->expires_at) { return false; } return strtotime($this->expires_at) < time(); } /** * Check if the short URL is still valid * * @return bool */ public function isValid() { return !$this->isExpired(); } /** * Increment the visit counter * * @return bool */ public function incrementVisits() { $this->visits++; $this->last_visit = date('Y-m-d H:i:s'); return $this->save(); } }