public function logDownload(Request $request, $id, $uuid) { $provision = \App\Provision::where('id', $id)->where('uuid', $uuid)->first(); if ($provision === null) { $request->session()->flash(str_random(4), ['type' => 'danger', 'message' => 'Could not find id/uuid combo']); return response()->json(['status' => 'broken']); } $logPath = storage_path('logs/provision/' . $uuid . '.output'); // Storage::exists checks if it's a real file with 'is_file' which fails on vagrant for some reason // So we have to do it old style if (file_exists(storage_path('logs/provision/' . $uuid . '.output')) === false) { return App::abort(404); } return response()->download($logPath, 'fodor-provisioning-log-' . $uuid . '.log'); }
public function subdomainAvailable($subdomain) { return \App\Provision::where('subdomain', $subdomain)->first() === null; }