From: Louis Jeckel Date: Fri, 4 Sep 2020 09:59:15 +0000 (+0200) Subject: Update WeeklyAgenda.php X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=81833aa60797eed34f0c8892e4eb8fdaf9366dba;p=psq.git Update WeeklyAgenda.php --- diff --git a/app/Models/WeeklyAgenda.php b/app/Models/WeeklyAgenda.php index 0e5da81..f268840 100644 --- a/app/Models/WeeklyAgenda.php +++ b/app/Models/WeeklyAgenda.php @@ -37,16 +37,42 @@ class WeeklyAgenda extends Model ], ]; + /** + * @return string + */ public function getTitleAttribute() { - return $this->start_date; + return $this->start_date->format('d/m/Y'); } + /** + * @return Carbon + */ public function getEndDateAttribute(): Carbon { return $this->start_date->addWeek(); } + public function getUrlAttribute() + { + return route('agenda.show', ['agenda' => $this->id]); + } + + + + public function nextWeekUrl() + { + return ($a = self::find($this->id + 1)) === null ? + null : + $a->url; + } + + public function lastWeekUrl() + { + return ($a = self::find($this->id - 1)) === null ? + null : + $a->url; + } }