-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
109 lines (90 loc) · 2.55 KB
/
run
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
namespace App;
use App\kernel\App;
use App\kernel\Request;
class artisan
{
public function __construct($argv)
{
$dir = __DIR__;
// ( $argv[] la );
$lat = array_key_last($argv);
$filename = $argv[$lat] ?? '';
$file = $filename ?? '';
$name =
$file ?? '';
if (
$argv[0] == 'run' and
$argv[1] == ''
) {
shell_exec("php -S localhost:8080 -t public");
}
foreach ($argv as $key) {
if ($key == '-migrate') {
if (in_array('down', $argv)) {
$uord = 'down';
}
if ($key == 'down' || $key == 'up') {
$func = $key ?? '';
}
require_once __DIR__ . "/config/migration/Migration.php";
$migpath = __DIR__ . "/config/migration/Migration.php $uord";
}
if ($key == '-c') {
require_once __DIR__ . "/kernel/strings/controller/controller.php";
$controller = fopen('app/controller/' . $file . '.php', 'wr', true);
if (
fwrite($controller, $fileinfo)
) {
echo "
****************
*********
****
CONTROLLER CREATED SUCCESSFULLY!
****
*********
****************\n" . PHP_EOL;
}
}
if ($key == 'del' and $key == '-d') {
$del = dirname(__DIR__) . "/mvc_by_me/controller/" . $file . ".php";
shell_exec("sudo rm $del");
}
if ($key == '-model') {
require_once __DIR__ . "/kernel/strings/controller/modal.php";
$controller = fopen('app/modal/' . $file . '.php', 'wr', true);
if (fwrite($controller, $fileinfo)) {
# code...
echo "
****************
*********
****
$file MODEL CREATED SUCCESSFULLY!
****
*********
****************\n" . PHP_EOL;
}
}
if ($key == '-migration') {
require_once __DIR__ . "/kernel/strings/controller/migration.php";
$controller = fopen('database/migrations/' . ucfirst($name) . '.php', 'wr', true);
if (fwrite($controller, $fileinfo)) {
echo "
****************
*********
****
$name MIGRATION CREATED SUCCESSFULLY!
****
*********
****************\n" . PHP_EOL;
}
}
if ($key == 'v') {
require_once __DIR__ . "/kernel/strings/controller/modal.php";
$controller = fopen('view/' . $file . '.php', 'wr', true);
fwrite($controller, $viewInfo);
}
}
}
}
new artisan($argv);