Ejemplo n.º 1
0
 public function bulkUpdate(DhcpBulkUpdateRequest $request)
 {
     foreach ($request->macs as $id => $mac) {
         $entry = DhcpEntry::findOrFail($id);
         $entry->mac = $mac;
         $entry->ip = $request->ips[$id];
         $entry->hostname = $request->hostnames[$id];
         $entry->save();
     }
     return redirect()->action('DhcpController@index')->with('success_message', 'Updated');
 }
Ejemplo n.º 2
0
 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');
 }