本文共 1337 字,大约阅读时间需要 4 分钟。
getDefaultConfirmCallback() : $callback;// set the callback $shouldConfirm = $callback instanceof Closure ? call_user_func($callback) : $callback; // check the confirm is the instance of the Closure. if ($shouldConfirm) {// the right confirm if ($this->option('force')) { return true; }// has a key to said be 'fore' $this->comment(str_repeat('*', strlen($warning) + 12));// set the comment string $this->comment('* '.$warning.' *');// increment the $this->comment(str_repeat('*', strlen($warning) + 12));// get the * $this->output->writeln('');// use a function to be $confirmed = $this->confirm('Do you really wish to run this command? [y/N]'); // set the confirm way if (! $confirmed) { $this->comment('Command Cancelled!'); return false; }// get } return true; }// confirm before the action be run /** * Get the default confirmation callback. * * @return \Closure */ protected function getDefaultConfirmCallback() { return function () { return $this->getLaravel()->environment() == 'production'; }; }// Get the default confirmation}
转载于:https://blog.51cto.com/jingshanls/1763665