Skip to content

Instantly share code, notes, and snippets.

@DarkGhostHunter
Last active March 17, 2023 07:09
Show Gist options
  • Save DarkGhostHunter/ce34cbe022d29afa852c479704ccaca3 to your computer and use it in GitHub Desktop.
Save DarkGhostHunter/ce34cbe022d29afa852c479704ccaca3 to your computer and use it in GitHub Desktop.
958dd096db-User
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
// ...
/**
* The the Audio Files the user has from their subscribed podcasts.
*/
public function audioFiles()
{
return $this->hasManyThrough(
'App\AudioFiles', // The model to access to
'App\Pivots\Subscription', // The intermediate table that connects the User with the Podcast.
'user_id', // The column of the intermediate table that connects to this model by its ID.
'podcast_id', // The column of the intermediate table that connects the Podcast by its ID.
'id', // The column that connects this model with the intermediate model table.
'podcast_id' // The column of the Audio Files table that ties it to the Podcast.
);
}
}
@n8udd
Copy link

n8udd commented Jul 15, 2022

Line #24 should be };

@DarkGhostHunter
Copy link
Author

Line #24 should be };

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment