This commit is contained in:
2025-02-16 21:11:07 +02:00
parent 87bbfc33d3
commit e8d7e6a1c4
253 changed files with 3879 additions and 72 deletions
+5
View File
@@ -21,4 +21,9 @@ class Comment extends Model
'tmdb_id',
'tmdb_url',
];
public function author()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
}
+15 -1
View File
@@ -2,9 +2,23 @@
namespace App\Models\Forum;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
//
protected $table = 'forum_posts';
protected $fillable = [
'content',
'user_id',
'category_id',
'thread_id',
'topic_id',
];
public function author()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
}
+5
View File
@@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Thread extends Model
{
protected $table = 'forum_threads';
public function category()
{
return $this->hasOne(Category::class, 'id', 'category_id');
}
}
+5
View File
@@ -8,6 +8,9 @@ class Topic extends Model
{
protected $table = 'forum_topics';
public const STATUS_OPEN = 'open';
public const STATUS_CLOSED = 'closed';
protected $fillable = [
'name',
'slug',
@@ -15,5 +18,7 @@ class Topic extends Model
'category_id',
'thread_id',
'user_id',
'views_no',
'replies_no',
];
}
+11
View File
@@ -58,6 +58,17 @@ class Movie extends Model
return $rating ? $rating->rate : null;
}
public function trailer()
{
return $this->belongsToMany(Video::class, 'movie_videos', 'movie_id', 'video_id')
->where('videos.type', 'Trailer');
}
public function externalIds()
{
return $this->hasOne(ExternalId::class, 'entity_id', 'id')->where('entity_type', ExternalId::TYPE_MOVIE);
}
public function director()
{
return $this->belongsToMany(Person::class, 'movie_cast', 'movie_id', 'person_id')