2025-12-12 23:07:04 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2025-12-30 21:15:42 -06:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2025-12-12 23:07:04 -06:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
|
|
|
|
class MovieList extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'user_id',
|
|
|
|
|
'name',
|
|
|
|
|
'is_public'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function movies(): BelongsToMany
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsToMany(Movie::class);
|
|
|
|
|
}
|
2025-12-30 21:15:42 -06:00
|
|
|
|
|
|
|
|
public function owner(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
|
|
|
}
|
2025-12-30 23:57:45 -06:00
|
|
|
|
|
|
|
|
public function sharedUsers(): BelongsToMany
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsToMany(User::class)->withPivot('permission')->withTimestamps();
|
|
|
|
|
}
|
2025-12-12 23:07:04 -06:00
|
|
|
}
|