40 lines
646 B
PHP
40 lines
646 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\Zone;
|
|
|
|
class ZoneController extends Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
/**
|
|
* Add or edit a node
|
|
*/
|
|
public function add_edit(Request $request,Zone $o)
|
|
{
|
|
if ($request->post()) {
|
|
foreach (['zone_id','name','active','description','notes','domain_id'] as $key)
|
|
$o->{$key} = $request->post($key);
|
|
|
|
$o->active = TRUE;
|
|
$o->save();
|
|
|
|
return redirect()->action([self::class,'home']);
|
|
}
|
|
|
|
return view('zone.addedit')
|
|
->with('o',$o);
|
|
}
|
|
|
|
public function home()
|
|
{
|
|
return view('zone.home');
|
|
}
|
|
}
|