Пример #1
0
 public function update(Request $request, $subnetId)
 {
     if (!$request->has('ids')) {
         return redirect()->action('DhcpRangeController@edit', $subnetId)->with('success_message', 'Awww');
     }
     $subnet = DhcpSubnet::findOrFail($subnetId);
     foreach ($request->ids as $index => $id) {
         $range = DhcpRange::findOrNew($id);
         $range->start = $request->starts[$index];
         $range->end = $request->ends[$index];
         $range->subnet_id = $subnetId;
         if (!$range->start and !$range->end) {
             $range->delete();
         } else {
             $range->save();
         }
     }
     // $ranges = $subnet->ranges;
     // foreach ($ranges as $range) {
     //     $parts = preg_split('\.', $range->start);
     //     $ip1 = $parts[3];
     //     $parts = preg_split('\.', $range->end);
     //     $ip2 = $parts[3];
     //     $valueRange = range($ip1, $ip1);
     // }
     return redirect()->action('DhcpRangeController@edit', $subnetId)->with('success_message', 'Updated!');
 }
Пример #2
0
 public function edit($subnetId = null)
 {
     $options = DhcpOption::forSubnet($subnetId);
     $subnetName = '';
     if ($subnetId) {
         $subnet = DhcpSubnet::findOrFail($subnetId);
         $subnetName = $subnet->name;
     }
     return view('dhcp.option.edit', compact('options', 'subnetId', 'subnetName'));
 }
Пример #3
0
 public function destroy($id)
 {
     $subnet = DhcpSubnet::findOrFail($id);
     $subnet->delete();
     return redirect()->action('DhcpSubnetController@index');
 }