コード例 #1
0
 public function rewriteDhcpConfig()
 {
     $date = date('Y-m-d-H-i-s');
     $fileToStore = 'dhcp/dhcpd.conf';
     $backupFile = 'dhcp/backups/dhcpd.conf-' . $date;
     Storage::copy($fileToStore, $backupFile);
     $globalOptions = DhcpOption::first();
     $sharedNetworks = DhcpSharedNetwork::with('subnets')->get();
     $template = view()->file(app_path('../resources/views/dhcp/templates/dhcpd-body.blade.php'))->with('dhcpOptions', $globalOptions)->with('sharedNetworks', $sharedNetworks);
     Storage::put($fileToStore, $template);
     logThis('dhcpd.conf rewritten, backup written to ' . $backupFile);
 }
コード例 #2
0
ファイル: SubnetCalc.php プロジェクト: goatatwork/access2
 /**
  * The Construct
  */
 public function __construct($ipaddress, $cidr, $gateway_setting = 'top')
 {
     $this->ipaddress = $ipaddress;
     $this->cidr = $cidr;
     $this->gateway_setting = $gateway_setting;
     $this->net_addr = IP\NetworkAddress::factory($this->ipaddress, $this->cidr);
     $dhcp = DhcpOption::first();
     $this->default_lease_time = $dhcp->default_lease_time;
     $this->max_lease_time = $dhcp->max_lease_time;
     $this->dns_1 = $dhcp->dns_1;
     $this->dns_2 = $dhcp->dns_2;
     $this->dns_3 = $dhcp->dns_3;
     $this->dns_4 = $dhcp->dns_4;
 }
コード例 #3
0
 /**
  * Get the DHCP Global Options
  */
 public function index()
 {
     return DhcpOption::first();
 }