47 lines
870 B
PHP
47 lines
870 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers;
|
||
|
|
||
|
use Illuminate\Http\Request;
|
||
|
|
||
|
use App\Models\Node;
|
||
|
|
||
|
class NodeController extends Controller
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->middleware('auth');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Add or edit a node
|
||
|
*/
|
||
|
public function add_edit(Request $request,Node $o)
|
||
|
{
|
||
|
if ($request->post()) {
|
||
|
foreach ([
|
||
|
'zone_id','host_id','node_id','point_id',
|
||
|
'system','sysop','location','email',
|
||
|
'address','port','notes','software_id','protocol_id',
|
||
|
'sespass','pktpass','ticpass','fixpass'
|
||
|
] as $key)
|
||
|
$o->{$key} = $request->post($key);
|
||
|
|
||
|
foreach(['is_zc','is_rc','is_hub','is_host','active'] as $key)
|
||
|
$o->{$key} = $request->post($key,FALSE);
|
||
|
|
||
|
$o->save();
|
||
|
|
||
|
return redirect()->action([self::class,'home']);
|
||
|
}
|
||
|
|
||
|
return view('node.addedit')
|
||
|
->with('o',$o);
|
||
|
}
|
||
|
|
||
|
public function home()
|
||
|
{
|
||
|
return view('node.home');
|
||
|
}
|
||
|
}
|