After recieving the request the following code compiles it
if ($request->lang === 'C') {
$outputGcc = shell_exec('gcc '.escapeshellarg(storage_path('app/codes/'.$codefile))
.' -o '.escapeshellarg(storage_path('app/codes/progs/'.$exefile)).' 2>&1');
} else if ($request->lang === 'C++') {
$outputGcc = shell_exec('g++ '.escapeshellarg(storage_path('app/codes/'.$codefile))
.' -o '.escapeshellarg(storage_path('app/codes/progs/'.$exefile)).' 2>&1');
}