Question

In laravel I create model named 'Test':

class Test extends Eloquent { protected $table = 'test'; }

then run composer dump-autoload then I use this code in controller :

$arr = Test::first(); dd($arr);

but this error appear:

Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to undefined method Test::first()

Was it helpful?

Solution

You are probably not using that same Test class (extended from Eloquent), to be sure, you can get the full path of it by doing:

$reflector = new ReflectionClass('Test');

dd($reflector->getFileName());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top