validate([ 'command' => ['sometimes', 'string'], ]); $result = Process::pipe(function (Pipe $pipe) { $pipe->command('ls -la '.base_path()); // $pipe->command('grep -i "laravel"'); }); return $result->successful() ? '
'.$result->output().'' : $result->errorOutput(); } }