Details
I have 3 tables :
- catalog_downloads
- export_frequencies
- export_frequencies_catalog_downloads (Pivot Table)
Diagram
I am not sure if I set the relation between them correctly. Please correct me if I am wrong.
Here is what I did
In CatalogDownload.php
public function export_frequencies(){
return $this->belongsToMany('ExportFrequency','export_frequencies_catalog_downloads','export_frequency_id','catalog_download_id');
}
In ExportFrequency.php
public function catalog_downloads(){
return $this->belongsToMany('CatalogDownload','export_frequencies_catalog_downloads','export_frequency_id','catalog_download_id');
}
Questions
According to my diagram - Did I assign the relationship correctly ? I hope I didn't mix up between
hasMany
andbelongsTo
Will I need a class or a model for a Pivot Table ?
Thanks