File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public function definition(): array
20
20
{
21
21
return [
22
22
'city_id ' => City::inRandomOrder ()->firstOrFail ()->id ,
23
- 'property_id ' => Property:: factory () ,
23
+ 'property_id ' => null ,
24
24
'address_line ' => fake ()->streetAddress ()
25
25
];
26
26
}
Original file line number Diff line number Diff line change 6
6
use App \Models \User ;
7
7
use App \Models \PropertyStatus ;
8
8
use App \Services \TextUniqueSlugService ;
9
+ use App \Models \PropertyAddress ;
10
+ use App \Models \Property ;
9
11
10
12
/**
11
13
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Property>
@@ -30,4 +32,13 @@ public function definition(): array
30
32
'status_id ' => PropertyStatus::inRandomOrder ()->firstOrFail ()->id ,
31
33
];
32
34
}
35
+
36
+ public function configure (): static
37
+ {
38
+ return $ this ->afterMaking (function (Property $ property ) {
39
+ PropertyAddress::factory ()->make (['property_id ' => $ property ->id ]);
40
+ })->afterCreating (function (Property $ property ) {
41
+ PropertyAddress::factory ()->create (['property_id ' => $ property ->id ]);
42
+ });
43
+ }
33
44
}
Original file line number Diff line number Diff line change 6
6
use Illuminate \Support \Facades \DB ;
7
7
use Illuminate \Support \Facades \Schema ;
8
8
use App \Models \User ;
9
- use App \Models \PropertyAddress ;
9
+ use App \Models \Property ;
10
10
11
11
class FakerSeeder extends Seeder
12
12
{
@@ -19,7 +19,7 @@ public function run()
19
19
{
20
20
User::factory ()->count (58 )->create ();
21
21
22
- //this will make both properties and property
23
- PropertyAddress ::factory ()->count (127 )->create ();
22
+ //this will create properties
23
+ Property ::factory ()->count (127 )->create ();
24
24
}
25
25
}
You can’t perform that action at this time.
0 commit comments