-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
artisan
31 lines (27 loc) · 884 Bytes
/
artisan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
const DS = DIRECTORY_SEPARATOR;
const DSUP = '..' . DS;
require_once __DIR__ . DS . 'vendor' . DS . 'autoload.php';
require_once __DIR__ . DS . 'config' . DS . 'database.php';
use Database\Seeders\DatabaseSeeder;
unset($argv[0]);
$inputs = array_values($argv);
if (isset($inputs[0])) {
if ($inputs[0] == "serve") {
if (isset($inputs[1])) {
$key = explode("=", $inputs[1])[0];
if ($key === "--port") {
$value = substr($inputs[1], 7);
shell_exec('cd public && php -S 127.0.0.1:' . $value . "");
} else {
echo "The command has no response";
}
} else {
shell_exec('cd public && php -S 127.0.0.1:8000');
}
} elseif ($inputs[0] == "db:seed") {
DatabaseSeeder::run();
} else {
echo "The command has no response";
}
}