zoniko's avatar

Lumen - ModelNotFoundException in Builder.php line 125

I got this error in Lumen when using protected $table in the model class: ModelNotFoundException in Builder.php line 125

This is my route file:

class CodesTypesUser extends Illuminate\Database\Eloquent\Model {

        /**
        * The database table used by the model.
        *
        * @var string
        */
        protected $table = 'codes_types_user';

}


$app->get('/getcodesconfig/{userid}', function($userid) {
        return CodesTypesUser::findOrFail(['user_id' => $userid]);
});

If I dont declare the $table it works... but with the default table name which I don't want. Please help.

0 likes
1 reply
zoniko's avatar

I think the error was in findOrFail.. It just does not work the way I thought It was.

I use a where statement instead.

Please or to participate in this conversation.