mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
* Revert "Forked release" * Initial factory builder support * Oops — fixed tabs * Revert "Forked release" * Whitespace * Reverted more code * Whitespace * More whitespace * Fixed PHPCS line
31 lines
658 B
PHP
31 lines
658 B
PHP
<?php
|
|
|
|
namespace Barryvdh\LaravelIdeHelper;
|
|
|
|
use Exception;
|
|
use Illuminate\Database\Eloquent\Factory;
|
|
use ReflectionClass;
|
|
|
|
class Factories
|
|
{
|
|
|
|
public static function all()
|
|
{
|
|
$factories = [];
|
|
|
|
$factory = app(Factory::class);
|
|
|
|
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
|
$definitions->setAccessible(true);
|
|
|
|
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
|
try {
|
|
$factories[] = new ReflectionClass($factory_target);
|
|
} catch (Exception $exception) {
|
|
}
|
|
}
|
|
|
|
return $factories;
|
|
}
|
|
}
|