Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
setName('new')
->setDescription('Create a new Laravel application')
->addArgument('name', InputArgument::OPTIONAL)
->addOption('dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release')
->addOption('jet', null, InputOption::VALUE_NONE, 'Installs the Laravel Jetstream scaffolding')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Forces install even if the directory already exists');
}
/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('jet')) {
$output->write(PHP_EOL."
| | |
|,---.|--- ,---.|--- ,---.,---.,---.,-.-.
||---'| `---.| | |---',---|| | |
`---'`---'`---'`---'`---'` `---'`---^` ' '>".PHP_EOL.PHP_EOL);
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('Which Jetstream stack do you prefer?', [
'livewire',
'inertia',
]);
$output->write(PHP_EOL);
$stack = $helper->ask($input, new SymfonyStyle($input, $output), $question);
$teams = (new SymfonyStyle($input, $output))->confirm('Will your application use teams?', false);
} else {
$output->write(PHP_EOL.' _ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | \'__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|'.PHP_EOL.PHP_EOL);
}
sleep(1);
if (version_compare(PHP_VERSION, '7.3.0', '<')) {
throw new RuntimeException('The Laravel installer requires PHP 7.3.0 or greater. Please use "composer create-project laravel/laravel" instead.');
}
$name = $input->getArgument('name');
$directory = $name && $name !== '.' ? getcwd().'/'.$name : '.';
$version = $this->getVersion($input);
if (! $input->getOption('force')) {
$this->verifyApplicationDoesntExist($directory);
}
$composer = $this->findComposer();
$commands = [
$composer." create-project laravel/laravel $directory $version --remove-vcs --prefer-dist",
"chmod 644 $directory/artisan",
];
if ($directory != '.') {
array_unshift($commands, "rm -rf $directory");
}
if ($this->runCommands($commands, $input, $output)->isSuccessful()) {
$this->replaceInFile(
'APP_URL=http://localhost',
'APP_URL=http://'.$name.'.test',
$directory.'/.env'
);
$this->replaceInFile(
'DB_DATABASE=laravel',
'DB_DATABASE='.str_replace('-', '_', strtolower($name)),
$directory.'/.env'
);
if ($input->getOption('jet')) {
$this->installJetstream($directory, $stack, $teams, $input, $output);
}
$output->writeln(PHP_EOL.'Application ready! Build something amazing.');
}
return 0;
}
/**
* Install Laravel Jetstream into the application.
*
* @param string $directory
* @param string $stack
* @param bool $teams
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
protected function installJetstream(string $directory, string $stack, bool $teams, InputInterface $input, OutputInterface $output)
{
chdir($directory);
$commands = array_filter([
$this->findComposer().' require laravel/jetstream',
trim(sprintf(PHP_BINARY.' artisan jetstream:install %s %s', $stack, $teams ? '--teams' : '')),
$stack === 'inertia' ? 'npm install && npm run dev' : null,
PHP_BINARY.' artisan storage:link',
]);
$this->runCommands($commands, $input, $output);
}
/**
* Verify that the application does not already exist.
*
* @param string $directory
* @return void
*/
protected function verifyApplicationDoesntExist($directory)
{
if ((is_dir($directory) || is_file($directory)) && $directory != getcwd()) {
throw new RuntimeException('Application already exists!');
}
}
/**
* Get the version that should be downloaded.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @return string
*/
protected function getVersion(InputInterface $input)
{
if ($input->getOption('dev')) {
return 'dev-develop';
}
return '';
}
/**
* Get the composer command for the environment.
*
* @return string
*/
protected function findComposer()
{
$composerPath = getcwd().'/composer.phar';
if (file_exists($composerPath)) {
return '"'.PHP_BINARY.'" '.$composerPath;
}
return 'composer';
}
/**
* Run the given commands.
*
* @param array $commands
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return Process
*/
protected function runCommands($commands, InputInterface $input, OutputInterface $output)
{
if ($input->getOption('no-ansi')) {
$commands = array_map(function ($value) {
return $value.' --no-ansi';
}, $commands);
}
if ($input->getOption('quiet')) {
$commands = array_map(function ($value) {
return $value.' --quiet';
}, $commands);
}
$process = Process::fromShellCommandline(implode(' && ', $commands), null, null, null, null);
if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
try {
$process->setTty(true);
} catch (RuntimeException $e) {
$output->writeln('Warning: '.$e->getMessage());
}
}
$process->run(function ($type, $line) use ($output) {
$output->write(' '.$line);
});
return $process;
}
/**
* Replace the given string in the given file.
*
* @param string $search
* @param string $replace
* @param string $file
* @return string
*/
protected function replaceInFile(string $search, string $replace, string $file)
{
file_put_contents(
$file,
str_replace($search, $replace, file_get_contents($file))
);
}
}