This is driving me nuts. I have 2 tables;
In the models folder I have transaction.php
and explanation.php.
transactions.php:
<?php
class Transaction extends Eloquent {
public function explanation()
{
return $this->hasOne('Explanation');
}
}
explanation.php
<?php
class Explanation extends Eloquent {
}
I'm simply calling
Transaction::find(18)->explanation()->first();
The error that I'm receiving is
Method [hasone] is not defined on the Query class
Can anyone see where I'm going wrong?
Just figured this out, was reading the wrong documentation..
Laravel 4.x
$this->hasOne();
Laravel < 4.x
$this->has_one();