Level 122
So if you create relationships
User.php
public function channel()
{
return $this->belongsTo(Channel::class); // depends on channel_id column in users
}
public function videos()
{
return $this->hasMany(Video::class); //depends on user_id column on videos table
Channel.php
public function user()
{
return $this->hasOne(User::class); // depends on channel_id column in users
}
public function videos()
{
return $this->hasManyThrough(Video::class, User::class);
}
Video.php
public function users()
{
return $this->belongsTo(User::class); // depends on user_id column on videos table
}
https://laravel.com/docs/5.5/eloquent-relationships#has-many-through