Attributes are lost in conversion
Closed this issue · 0 comments
jeff1326 commented
See output of my dry run below.
58) modules/text_product/Database/factories/SupplierFactory.php:5
---------- begin diff ----------
@@ @@
use TextProduct\Models\Supplier;
use TextProduct\Models\Country;
-$factory->define(Supplier::class, fn(Faker $faker) => [
- 'name' => $faker->company,
- 'origin_country_id' => Country::factory(),
- 'type' => $faker->numberBetween(1, 3),
-]);
+class SupplierFactory extends \Illuminate\Database\Eloquent\Factories\Factory
+{
+ protected $model = Supplier::class;
+}
----------- end diff -----------
Applied rules:
* FactoryDefinitionRector (https://laravel.com/docs/7.x/database-testing#writing-factories)
Name, origin country id and type are lost in conversion.
Note that this is in another folder than a base laravel.
When i converted back the arrow function to anonymous functions (or closure if you prefer this term), this was working as expected.