work in progress

This commit is contained in:
Daan Meijer
2026-06-23 13:54:27 +02:00
parent d751cd4fdd
commit 1e33bfb50b
10 changed files with 70 additions and 25 deletions
+10
View File
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Support\Str;
use App\Models\Chat;
class Dynamic extends Model
{
@@ -64,4 +65,13 @@ class Dynamic extends Model
public function getUrlAttribute(): string {
return route('dynamics.show', $this);
}
public function getOrCreateChat(): Chat
{
if ($this->chat) {
return $this->chat;
}
return $this->chat()->create([]);
}
}