Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | 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 InvalidArgumentException;
7
use InvalidArgumentException;
-
 
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:controller')]
13
#[AsCommand(name: 'make:controller')]
12
class ControllerMakeCommand extends GeneratorCommand
14
class ControllerMakeCommand extends GeneratorCommand
Zeile 295... Zeile 297...
295
            ['requests', 'R', InputOption::VALUE_NONE, 'Generate FormRequest classes for store and update'],
297
            ['requests', 'R', InputOption::VALUE_NONE, 'Generate FormRequest classes for store and update'],
296
            ['singleton', 's', InputOption::VALUE_NONE, 'Generate a singleton resource controller class'],
298
            ['singleton', 's', InputOption::VALUE_NONE, 'Generate a singleton resource controller class'],
297
            ['creatable', null, InputOption::VALUE_NONE, 'Indicate that a singleton resource should be creatable'],
299
            ['creatable', null, InputOption::VALUE_NONE, 'Indicate that a singleton resource should be creatable'],
298
        ];
300
        ];
299
    }
301
    }
-
 
302
 
-
 
303
    /**
-
 
304
     * Interact further with the user if they were prompted for missing arguments.
-
 
305
     *
-
 
306
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
-
 
307
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
-
 
308
     * @return void
-
 
309
     */
-
 
310
    protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
-
 
311
    {
-
 
312
        if ($this->didReceiveOptions($input)) {
-
 
313
            return;
-
 
314
        }
-
 
315
 
-
 
316
        $type = $this->components->choice('Which type of controller would you like', [
-
 
317
            'empty',
-
 
318
            'api',
-
 
319
            'invokable',
-
 
320
            'resource',
-
 
321
            'singleton',
-
 
322
        ], default: 0);
-
 
323
 
-
 
324
        if ($type !== 'empty') {
-
 
325
            $input->setOption($type, true);
-
 
326
        }
-
 
327
 
-
 
328
        if (in_array($type, ['api', 'resource', 'singleton'])) {
-
 
329
            $model = $this->components->askWithCompletion(
-
 
330
                "What model should this $type controller be for?",
-
 
331
                $this->possibleModels(),
-
 
332
                'none'
-
 
333
            );
-
 
334
 
-
 
335
            if ($model && $model !== 'none') {
-
 
336
                $input->setOption('model', $model);
-
 
337
            }
-
 
338
        }
-
 
339
    }
300
}
340
}