-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Fix autoresolving model name from factory (#40616)
* Fix autoresolving model name from factory * Reverse change to fallback factory * Add test
- Loading branch information
1 parent
22e32b9
commit da28a53
Showing
4 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Database\Fixtures\Factories\Money; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class PriceFactory extends Factory | ||
{ | ||
public function definition() | ||
{ | ||
return [ | ||
'name' => $this->faker->name, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Database\Fixtures\Models\Money; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Tests\Database\Fixtures\Factories\Money\PriceFactory; | ||
|
||
class Price extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $table = 'prices'; | ||
|
||
public static function factory() | ||
{ | ||
return PriceFactory::new(); | ||
} | ||
} |