phper
phper

Reputation: 181

Eloquent laravel error

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()

Upvotes: 0

Views: 50

Answers (1)

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87779

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());

Upvotes: 1

Related Questions