baopham / laravel-dynamodb

Eloquent syntax for DynamoDB

Home Page:https://packagist.org/packages/baopham/dynamodb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Factory Create - Bad connection name

macedd opened this issue · comments

I'm configuring a system which has various DBs. By default config('database.default') is equal to mysql. I have installed dynamodb and set its configurations.

The problem is when a DynamoDbModel is created by a factory:

    $user = factory(User::class)->create();

The result is $connection property from the model is filled with mysql string. And thus AWS DynamoDB Client thrown an error due to invalid configuration.

Hm.... Ive never tested it with factory. So you can say, it is not yet supported. Can you not use factory for now?

Its possible. factory(User::class)->create() fails because queryBuilder is not compliant with it, but one can simply

$user = factory(User::class)->make();
$user->save();

Nice. Will put this to FAQ.