Created
July 31, 2019 09:44
-
-
Save j-dexx/ad381876c0711fb65245adc81818af5e to your computer and use it in GitHub Desktop.
Journal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Journal | |
| { | |
| // journals this journal references | |
| public function references() | |
| { | |
| return $this->belongsToMany(Journal::class, 'references', 'journal_id', 'reference_id'); | |
| } | |
| // inverse the keys to retrieve journals this is referenced by | |
| public function referencedByJournals() | |
| { | |
| return $this->belongsToMany(Journal::class, 'references', 'reference_id', 'journal_id'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment