This commit is contained in:
2025-06-12 21:45:34 +05:00
parent c2298d1550
commit b7b3f3ded4

View File

@@ -11,18 +11,14 @@ class GitPullController extends Controller
public function index(Request $request) public function index(Request $request)
{ {
$request->validate([ $request->validate([
'command' => ['sometimes', 'string'] 'command' => ['sometimes', 'string'],
]); ]);
$result = Process::pipe(function (Pipe $pipe) { $result = Process::pipe(function (Pipe $pipe) {
$pipe->command('ls -la '. base_path()); $pipe->command('ls -la '.base_path());
// $pipe->command('grep -i "laravel"'); // $pipe->command('grep -i "laravel"');
}); });
return [ return $result->successful() ? '<pre>'.$result->output().'</pre>' : $result->errorOutput();
'successful' => $result->successful(),
'errorOutput' => $result->errorOutput(),
'output' => '<pre>'.$result->output().'</pre>',
];
} }
} }