public function getDhcpFile() { if (Cache::has('dhcpfile')) { return (new Response(Cache::get('dhcpfile'), 200))->header('Content-Type', 'text/plain'); } $globals = DhcpOption::globals()->get(); $networks = DhcpSharedNetwork::all(); $subnets = DhcpSubnet::notInSharedNetwork()->get(); $entries = DhcpEntry::all(); $dhcpFile = new DhcpFile($globals, $networks, $subnets, $entries); $contents = Cache::rememberForever('dhcpfile', function () use($dhcpFile) { return $dhcpFile->asText(); }); return (new Response($contents, 200))->header('Content-Type', 'text/plain'); }