[On Laravel 5.5, php 7, 32Bit Ubuntu]
I have a simple model that has the following method:
static function loop()
{
self::where('loop', 1)->increment('loop_count');
$status = self::where('loop',1)->first();
$looping = $status->loop;
var_dump($looping);
dd($looping);
return $looping;
}
The value of loop
in the database for the record in question is 1.
var_dump and dd returns as expected:
int(1)
1
However if I just let the function return normally I get
ErrorException (E_NOTICE)
Trying to get property of non-object
With the debugger hilighting this line:
$looping = $status->loop;
as the offending code.
What gives?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2EPexY9
via IFTTT
Aucun commentaire:
Enregistrer un commentaire