Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 399
Zeile 4... Zeile 4...
4
 
4
 
5
use Illuminate\Console\Concerns\CreatesMatchingTest;
5
use Illuminate\Console\Concerns\CreatesMatchingTest;
6
use Illuminate\Console\GeneratorCommand;
6
use Illuminate\Console\GeneratorCommand;
7
use Illuminate\Support\Str;
7
use Illuminate\Support\Str;
-
 
8
use Symfony\Component\Console\Attribute\AsCommand;
8
use Symfony\Component\Console\Attribute\AsCommand;
9
use Symfony\Component\Console\Input\InputInterface;
-
 
10
use Symfony\Component\Console\Input\InputOption;
Zeile 9... Zeile 11...
9
use Symfony\Component\Console\Input\InputOption;
11
use Symfony\Component\Console\Output\OutputInterface;
10
 
12
 
11
#[AsCommand(name: 'make:model')]
13
#[AsCommand(name: 'make:model')]
12
class ModelMakeCommand extends GeneratorCommand
14
class ModelMakeCommand extends GeneratorCommand
Zeile 231... Zeile 233...
231
            ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'],
233
            ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'],
232
            ['api', null, InputOption::VALUE_NONE, 'Indicates if the generated controller should be an API resource controller'],
234
            ['api', null, InputOption::VALUE_NONE, 'Indicates if the generated controller should be an API resource controller'],
233
            ['requests', 'R', InputOption::VALUE_NONE, 'Create new form request classes and use them in the resource controller'],
235
            ['requests', 'R', InputOption::VALUE_NONE, 'Create new form request classes and use them in the resource controller'],
234
        ];
236
        ];
235
    }
237
    }
-
 
238
 
-
 
239
    /**
-
 
240
     * Interact further with the user if they were prompted for missing arguments.
-
 
241
     *
-
 
242
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
-
 
243
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
-
 
244
     * @return void
-
 
245
     */
-
 
246
    protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
-
 
247
    {
-
 
248
        if ($this->didReceiveOptions($input)) {
-
 
249
            return;
-
 
250
        }
-
 
251
 
-
 
252
        collect($this->components->choice('Would you like any of the following?', [
-
 
253
            'none',
-
 
254
            'all',
-
 
255
            'factory',
-
 
256
            'form requests',
-
 
257
            'migration',
-
 
258
            'policy',
-
 
259
            'resource controller',
-
 
260
            'seed',
-
 
261
        ], default: 0, multiple: true))
-
 
262
        ->reject('none')
-
 
263
        ->map(fn ($option) => match ($option) {
-
 
264
            'resource controller' => 'resource',
-
 
265
            'form requests' => 'requests',
-
 
266
            default => $option,
-
 
267
        })
-
 
268
        ->each(fn ($option) => $input->setOption($option, true));
-
 
269
    }
236
}
270
}