feat: worry box feature implemented

This commit is contained in:
2025-08-31 14:50:08 +03:30
parent 58ddf66c12
commit ed377842c9
9 changed files with 221 additions and 16 deletions
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Note extends Model
{
protected $fillable = ['user_id', 'content', 'noteable_id', 'noteable_type'];
public function user()
{
return $this->belongsTo(User::class);
}
public function noteable()
{
return $this->morphTo();
}
}
+4
View File
@@ -16,4 +16,8 @@ public function mood()
{
return $this->belongsTo(Mood::class);
}
public function notes()
{
return $this->morphMany(Note::class, 'noteable');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Worry extends Model
{
protected $fillable = ['user_id', 'title', 'is_solved'];
public function user()
{
return $this->belongsTo(User::class);
}
public function notes()
{
return $this->morphMany(Note::class, 'noteable');
}
}