Comments (3)
I found out that using an array syntax when defining factory , causes this error
for example:
this syntax is ok with laravel, if you are not passing any Faker in the function
this is the short syntax but for some reason your Generatecommand throw error in this?
why? you should also accept this syntax...
$factory->state(User::class, 'payment', [
'payment' => [
'name' => 'BDO',
'amount' => 12000,
'paid' => true
]
]);
after changing to this syntax error goes away
$factory->state(User::class, 'payment', function () {
return [
'payment' => [
'name' => 'BDO',
'amount' => 12000,
'paid' => true
]
];
});
from laravel-factories-reloaded.
Thanks @codeitlikemiley. We had this on our list. Let me check that.
from laravel-factories-reloaded.
@nuernbergerA and me took a look you are right. The array
syntax is not supported currently. I change the code so it throws now a new exception with a helpful message about it.
It is quite some amount of work to make arrays work too, so we won't focus on supporting that right now. But we will at some point in the future. Please use the closure syntax for now.
from laravel-factories-reloaded.
Related Issues (20)
- Better default belongTo relation syntax HOT 2
- Automated code review for Laravel Factories Reloaded HOT 1
- Generate Command Produced A Class with Extra ")" on return statement HOT 2
- overwriteDefaults only apply last one HOT 2
- Support for factory callbacks HOT 3
- ->times() breaks most functionality added to factory HOT 1
- $extra data not work with times HOT 2
- Support closures HOT 4
- Hardcoded `id` when using factory as data HOT 5
- Nested model configuration HOT 5
- Using model in data like in Laravel factories HOT 2
- Creating a model instance with a relation but generating extra data without relation HOT 7
- Mass Assignment HOT 3
- Update to work with Laravel 8.0? HOT 19
- Further development of this packages: HOT 2
- PHP 8 Support HOT 7
- massive assignment on withFactory() method
- Cannot resolve factories when vanilla factory namespace is not Database\Factories\ HOT 1
- Deep nested relationships don't get persisted HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-factories-reloaded.