]> _ Git - psq.git/commitdiff
Update WeeklyAgenda.php
authorLouis Jeckel <louis.jeckel@outlook.cm>
Fri, 4 Sep 2020 09:59:15 +0000 (11:59 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Fri, 4 Sep 2020 09:59:15 +0000 (11:59 +0200)
app/Models/WeeklyAgenda.php

index 0e5da816d8df28072bef2deb128876d24d934cd5..f26884072327a31bfb0a2122b0307030cf2c753a 100644 (file)
@@ -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;
+    }
 
 }