Skip to content

Instantly share code, notes, and snippets.

@EricMcWinNer
Created September 11, 2020 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricMcWinNer/5e8ca72bccbf5eca5f193d48b9160683 to your computer and use it in GitHub Desktop.
Save EricMcWinNer/5e8ca72bccbf5eca5f193d48b9160683 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PoliticalParty extends Model {
/**
* Get the candidates this party has
*/
public function candidates() {
return $this->hasMany(App\Model\Candidate::class, 'foreign_key', 'local_key');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment