Skip to content

Commit a35b03b

Browse files
committed
add reset demo app command.
1 parent 0a57eaf commit a35b03b

File tree

6 files changed

+63
-9
lines changed

6 files changed

+63
-9
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY composer.json ./
1616

1717
COPY composer.lock ./
1818

19-
RUN composer install --no-dev --no-scripts --no-autoloader
19+
RUN composer install --no-scripts --no-autoloader
2020

2121
COPY . /var/www/html/
2222

app/Console/Commands/InstallApp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace App\Console\Commands;
44

5-
use App\Services\Installation\AppInstallationService;
65
use Illuminate\Console\Command;
6+
use App\Services\Installation\AppInstallationService;
77

88
class InstallApp extends Command
99
{

app/Console/Commands/ResetDemoApp.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use App\Services\Installation\AppInstallationService;
7+
8+
/**
9+
* Class ResetDemoApp
10+
* @package App\Console\Commands
11+
*/
12+
class ResetDemoApp extends Command
13+
{
14+
15+
/**
16+
* @var string
17+
*/
18+
protected $signature = 'demo:reset';
19+
20+
21+
/**
22+
* @var string
23+
*/
24+
protected $description = 'Reset the application state for the demo site.';
25+
26+
27+
/**
28+
* ResetDemoApp constructor.
29+
*/
30+
public function __construct()
31+
{
32+
parent::__construct();
33+
}
34+
35+
36+
/**
37+
*
38+
*/
39+
public function handle()
40+
{
41+
$service = app(AppInstallationService::class);
42+
$this->info('cleaning up');
43+
$this->call('migrate:refresh');
44+
$this->info('Installing the app');
45+
$service->installApp([
46+
'name' => 'Api Demo Admin',
47+
'email' => 'admin@admin.com',
48+
'password' => 'secret123456789',
49+
'password_confirmation' => 'secret123456789'
50+
]);
51+
$this->info('Seed the database');
52+
$this->call('db:seed');
53+
$this->info('Done');
54+
}
55+
}

app/Console/Kernel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Console;
44

55
use App\Console\Commands\InstallApp;
6+
use App\Console\Commands\ResetDemoApp;
67
use Illuminate\Console\Scheduling\Schedule;
78
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
89

@@ -14,7 +15,9 @@ class Kernel extends ConsoleKernel
1415
* @var array
1516
*/
1617
protected $commands = [
17-
InstallApp::class
18+
InstallApp::class,
19+
// this is just for the demo, you can remove this on your application
20+
ResetDemoApp::class
1821
];
1922

2023
/**

database/factories/ModelFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'name' => $faker->name,
2020
'uuid' => $faker->uuid,
2121
'email' => $faker->unique()->safeEmail,
22-
'password' => $password ?: $password = 'secret',
22+
'password' => $password ?: $password = bcrypt('secret'),
2323
'remember_token' => str_random(10),
2424
];
2525
});

readme.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ Then run `php artisan passport:install`
7070

7171
Run `php artisan app:install` and fill out the information of the admin user.
7272

73-
Run `yarn install` to install node dependencies
74-
75-
Run `yarn dev` to compile the CSS and JS
76-
77-
You should be done with the basic configuration.
73+
You should be done with the basic installation and configuration.
7874

7975
## Tests
8076

0 commit comments

Comments
 (0)