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\GeneratorCommand;
5
use Illuminate\Console\GeneratorCommand;
6
use Illuminate\Support\Str;
6
use Illuminate\Support\Str;
7
use LogicException;
7
use LogicException;
-
 
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:policy')]
13
#[AsCommand(name: 'make:policy')]
12
class PolicyMakeCommand extends GeneratorCommand
14
class PolicyMakeCommand extends GeneratorCommand
Zeile 207... Zeile 209...
207
            ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the policy already exists'],
209
            ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the policy already exists'],
208
            ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'],
210
            ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'],
209
            ['guard', 'g', InputOption::VALUE_OPTIONAL, 'The guard that the policy relies on'],
211
            ['guard', 'g', InputOption::VALUE_OPTIONAL, 'The guard that the policy relies on'],
210
        ];
212
        ];
211
    }
213
    }
-
 
214
 
-
 
215
    /**
-
 
216
     * Interact further with the user if they were prompted for missing arguments.
-
 
217
     *
-
 
218
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
-
 
219
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
-
 
220
     * @return void
-
 
221
     */
-
 
222
    protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
-
 
223
    {
-
 
224
        if ($this->didReceiveOptions($input)) {
-
 
225
            return;
-
 
226
        }
-
 
227
 
-
 
228
        $model = $this->components->askWithCompletion(
-
 
229
            'What model should this policy apply to?',
-
 
230
            $this->possibleModels(),
-
 
231
            'none'
-
 
232
        );
-
 
233
 
-
 
234
        if ($model && $model !== 'none') {
-
 
235
            $input->setOption('model', $model);
-
 
236
        }
-
 
237
    }
212
}
238
}