Hi - thanks for the reply. I put it on a method so I have a "hook" if I want to do anything else in the future.
But to revert to your suggestion, I didn't have any luck with it, I'm afraid. I wondered was created_at some kind of reserved name or something:
Here is some set up and tests:
$this->bet = new Bet([
'customer_id' => 3,
'date' => '2015-02-02',
'event' => 'ds v karen',
'betting_on' => 'karen',
'bookmaker_id' => '1',
'back_or_lay' => 'Back',
'bet_type_id' => '4',
'odds' => '2.5',
'stake' => '25',
'commission' => 0,
'outcome' => 'Pending',
'profit' => null,
'profit_to' => '1',
'created_at' => '2015-12-30 00:59:06'
// 'updated_at' => '2015-12-30 00:59:06'
]);
Here is my test...
function testABetHasACreatedAtDate() {
$this->assertEquals('2015-12-30 00:59:06', $this->bet->created_at);
}
Here is my error...
Fatal error: Call to a member function connection() on a non-object in /Applications/MAMP/htdocs/mb-app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 3286
I actually think it is to do my created_at attribute in my Bet object, but I don't know what to do about it. I just can't seem to test it, trivial and pointless as it may be!
Thanks.
DS