3

This is driving me nuts. I have 2 tables;

  1. explanations and
  2. transactions.

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?

davejal
  • 6,009
  • 10
  • 39
  • 82
Luke Snowden
  • 4,056
  • 2
  • 37
  • 70

1 Answers1

4

Just figured this out, was reading the wrong documentation..

Laravel 4.x

$this->hasOne();

Laravel < 4.x

$this->has_one();
dualed
  • 10,262
  • 1
  • 26
  • 29
Luke Snowden
  • 4,056
  • 2
  • 37
  • 70