Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Phaseolies/Console/Schedule/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Command\Command as SymfonyCommand;

abstract class Command extends SymfonyCommand
Expand Down Expand Up @@ -430,7 +432,7 @@ protected function multipleChoice(string $question, array $choices, $default = n
$question = new ChoiceQuestion("<question>{$question}</question>", $choices);
$question->setMultiselect(true);
$question->setErrorMessage('Choice %s is invalid.');

// For multiselect, default as null
if ($default !== null) {
$question->setDefault($default);
Expand All @@ -447,7 +449,7 @@ protected function multipleChoice(string $question, array $choices, $default = n
*/
protected function createProgressBar(int $max = 0)
{
return new \Symfony\Component\Console\Helper\ProgressBar($this->output, $max);
return new ProgressBar($this->output, $max);
}

/**
Expand All @@ -457,6 +459,6 @@ protected function createProgressBar(int $max = 0)
*/
protected function createTable()
{
return new \Symfony\Component\Console\Helper\Table($this->output);
return new Table($this->output);
}
}
4 changes: 2 additions & 2 deletions src/Phaseolies/Database/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2044,8 +2044,8 @@ public function upsert(

// Normalize return value: always return the number of unique rows processed
if ($driver === 'mysql' && $rowCount > count($values)) {
// MySQL returns 2 for each updated row,
// but intentionally we want to return 1 per unique row
// MySQL returns 2 for each updated row,
// But intentionally we are returning 1
return count($values);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Phaseolies/Database/Eloquent/Query/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public function getUpsertSql(

/**
* Check if SQLite version supports ON CONFLICT clause
*
*
* @return bool
*/
protected function sqliteSupportsOnConflict(): bool
Expand Down
50 changes: 48 additions & 2 deletions src/Phaseolies/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,54 @@ class Installer
public static function postCreateProject(Event $event)
{
$io = $event->getIO();
$io->write("Setting up Doppar project.");

copy('.env.example', '.env');
$io->write("<info>🚀 Setting up doppar skeleton application...</info>");

if (!file_exists('.env')) {
copy('.env.example', '.env');
$io->write("<comment> ✓ Created .env file from .env.example</comment>");
} else {
$io->write("<comment> ⚠ .env file already exists, skipping</comment>");
}

$io->write("\n<info>🎉 Doppar project setup complete</info>");
}

public static function preInstall(Event $event)
{
$io = $event->getIO();
$io->write("<info>🔍 Checking system requirements...</info>");

$requirements = self::checkRequirements();

foreach ($requirements as $requirement => $met) {
if ($met) {
$io->write("<comment> ✓ {$requirement}</comment>");
} else {
$io->write("<error> ✗ {$requirement}</error>");
}
}

// Check if all requirements are met
if (in_array(false, $requirements, true)) {
$io->write("\n<error>Some system requirements are not met. Please fix them before continuing.</error>");
exit(1);
}

$io->write("\n<info>All system requirements met..</info>");
}

protected static function checkRequirements()
{
return [
'PHP >= 8.3' => version_compare(PHP_VERSION, '8.1.0', '>='),
'PDO Extension' => extension_loaded('pdo'),
'MBString Extension' => extension_loaded('mbstring'),
'JSON Extension' => extension_loaded('json'),
'OpenSSL Extension' => extension_loaded('openssl'),
'Tokenizer Extension' => extension_loaded('tokenizer'),
'XML Extension' => extension_loaded('xml'),
'Ctype Extension' => extension_loaded('ctype'),
];
}
}
Loading