Skip to content

Instantly share code, notes, and snippets.

@kerwitz
kerwitz / Father.php
Created May 21, 2015 11:15
Laravel 5: one to many relation with more then one related column
<?php namespace App\Models;
class Father extends Illuminate\Database\Eloquent\Model {
/**
* Get all children that call model their father.
*
* @return array
*/
public function children() {
return $this
->hasMany('App\Models\Child', 'id', 'biological_father_id')