Skip to content

Commit 46c2f5d

Browse files
authored
Merge pull request #1 from leafsphp/feat/sprout-rewrite
Feat/sprout rewrite
2 parents 6175bc4 + 8be7553 commit 46c2f5d

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
"prefer-stable": true,
3131
"require-dev": {
3232
"leafs/alchemy": "^2.2"
33+
},
34+
"require": {
35+
"leafs/sprout": "^0.6.0"
3336
}
3437
}

src/Billing/Commands/ConfigBillingComand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Leaf\Billing\Commands;
44

5-
use Aloe\Command;
5+
use Leaf\Sprout\Command;
66
use Symfony\Component\Yaml\Yaml;
77

88
class ConfigBillingComand extends Command
99
{
10-
protected static $defaultName = 'config:billing';
11-
public $description = 'Scaffold billing plans on payment provider';
10+
protected $signature = 'config:billing';
11+
protected $description = 'Scaffold billing plans on payment provider';
1212

13-
public $help = 'This command will scaffold billing plans on the payment provider. It will also cache your plans in storage/billing';
13+
protected $help = 'This command will scaffold billing plans on the payment provider. It will also cache your plans in storage/billing';
1414

1515
protected function handle()
1616
{

src/Billing/Commands/ScaffoldSubscriptionsCommand.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22

33
namespace Leaf\Billing\Commands;
44

5-
use Aloe\Command;
5+
use Leaf\Sprout\Command;
66
use Symfony\Component\Yaml\Yaml;
77

88
class ScaffoldSubscriptionsCommand extends Command
99
{
10-
protected static $defaultName = 'scaffold:subscriptions';
11-
public $description = 'Scaffold billing plans for subscriptions';
10+
protected $signature = 'scaffold:subscriptions
11+
{--scaffold=default : Which scaffold to use for subscriptions (default/react/vue/svelte)}';
12+
protected $description = 'Scaffold billing plans for subscriptions';
1213

13-
public $help = "This command will scaffold billing plans for your application. You can choose between different scaffolds like default, react, vue, svelte etc.";
14-
15-
protected function config()
16-
{
17-
$this
18-
->setOption('scaffold', 's', 'optional', 'Which scaffold to use for authentication (default/react/vue/svelte)', 'default');
19-
}
14+
protected $help = "This command will scaffold billing plans for your application. You can choose between different scaffolds like default, react, vue, svelte etc.";
2015

2116
protected function handle()
2217
{
@@ -38,12 +33,21 @@ protected function handle()
3833

3934
$this->info("Scaffolding subscriptions using $scaffold + $type");
4035

41-
\Aloe\Installer::magicCopy(__DIR__ . "/themes/subscriptions/$type");
42-
\Aloe\Installer::magicCopy(__DIR__ . "/themes/$scaffold");
36+
\Leaf\FS\Directory::copy(
37+
__DIR__ . "/themes/subscriptions/$type",
38+
getcwd(),
39+
['recursive' => true]
40+
);
41+
42+
\Leaf\FS\Directory::copy(
43+
__DIR__ . "/themes/$scaffold",
44+
getcwd(),
45+
['recursive' => true]
46+
);
4347

4448
$this->info('Scaffold generated successfully, running subscription schemas...');
4549

46-
\Aloe\Core::run('php leaf db:migrate subscriptions', $this->output());
50+
sprout()->process('php leaf db:migrate subscriptions')->run();
4751

4852
if (\Leaf\FS\File::exists($usersSchema = "$directory/app/database/users.yml")) {
4953
$data = Yaml::parseFile($usersSchema);
@@ -59,7 +63,7 @@ protected function handle()
5963
}
6064
}
6165

62-
\Aloe\Core::run('php leaf db:migrate users', $this->output());
66+
sprout()->process('php leaf db:migrate users')->run();
6367

6468
return 0;
6569
}

0 commit comments

Comments
 (0)