2021-05-13 12:40:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
use App\Models\Domain;
|
|
|
|
|
|
|
|
class DomainController extends Controller
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('auth');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add or edit a node
|
|
|
|
*/
|
|
|
|
public function add_edit(Request $request,Domain $o)
|
|
|
|
{
|
|
|
|
if ($request->post()) {
|
2021-04-01 10:59:15 +00:00
|
|
|
// @todo Add validation that we can only have 1 "default" domain for a zone.
|
|
|
|
// The default domain is used when a node connects and doesnt use a full 5D address, eg: 10:999/1 vs 10:999/1@private
|
2021-05-13 12:40:21 +00:00
|
|
|
foreach (['name','dnsdomain','active','notes'] as $key)
|
|
|
|
$o->{$key} = $request->post($key);
|
|
|
|
|
|
|
|
$o->active = TRUE;
|
|
|
|
$o->save();
|
|
|
|
|
|
|
|
return redirect()->action([self::class,'home']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return view('domain.addedit')
|
|
|
|
->with('o',$o);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function home()
|
|
|
|
{
|
|
|
|
return view('domain.home');
|
|
|
|
}
|
|
|
|
}
|