Getting the name of the foreign key with eloquent
This must be very basic stuff but I can't seem to find out how to do it. I have a one to many relationship between to tables: Unit and Army (an army contains many units) and these are my models: class Army extends Eloquent { protected $guarded = array(); public static $armies = array(); protected $table = 'armies'; public function units() { return $this->hasMany('Unit'); } } and: class Unit extends Eloquent { protected $guarded = array(); public static $units = array(); protected $table = 'units'; public function armies() { return $this->belongsTo('Army', 'army'); } } So, in my Unit table I