ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 3.129.73.174 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds.upgrade.nicn.gov.ng/funds-upgraded/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/ |
Upload File : |
<?php namespace Illuminate\Database\Console\Factories; use Illuminate\Console\GeneratorCommand; use Illuminate\Support\Str; use Symfony\Component\Console\Input\InputOption; class FactoryMakeCommand extends GeneratorCommand { /** * The console command name. * * @var string */ protected $name = 'make:factory'; /** * The console command description. * * @var string */ protected $description = 'Create a new model factory'; /** * The type of class being generated. * * @var string */ protected $type = 'Factory'; /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath('/stubs/factory.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } /** * Build the class with the given name. * * @param string $name * @return string */ protected function buildClass($name) { $factory = class_basename(Str::ucfirst(str_replace('Factory', '', $name))); $namespaceModel = $this->option('model') ? $this->qualifyModel($this->option('model')) : $this->qualifyModel($this->guessModelName($name)); $model = class_basename($namespaceModel); if (Str::startsWith($namespaceModel, $this->rootNamespace().'Models')) { $namespace = Str::beforeLast('Database\\Factories\\'.Str::after($namespaceModel, $this->rootNamespace().'Models\\'), '\\'); } else { $namespace = 'Database\\Factories'; } $replace = [ '{{ factoryNamespace }}' => $namespace, 'NamespacedDummyModel' => $namespaceModel, '{{ namespacedModel }}' => $namespaceModel, '{{namespacedModel}}' => $namespaceModel, 'DummyModel' => $model, '{{ model }}' => $model, '{{model}}' => $model, '{{ factory }}' => $factory, '{{factory}}' => $factory, ]; return str_replace( array_keys($replace), array_values($replace), parent::buildClass($name) ); } /** * Get the destination class path. * * @param string $name * @return string */ protected function getPath($name) { $name = (string) Str::of($name)->replaceFirst($this->rootNamespace(), '')->finish('Factory'); return $this->laravel->databasePath().'/factories/'.str_replace('\\', '/', $name).'.php'; } /** * Guess the model name from the Factory name or return a default model name. * * @param string $name * @return string */ protected function guessModelName($name) { if (Str::endsWith($name, 'Factory')) { $name = substr($name, 0, -7); } $modelName = $this->qualifyModel(Str::after($name, $this->rootNamespace())); if (class_exists($modelName)) { return $modelName; } if (is_dir(app_path('Models/'))) { return $this->rootNamespace().'Models\Model'; } return $this->rootNamespace().'Model'; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['model', 'm', InputOption::VALUE_OPTIONAL, 'The name of the model'], ]; } }