2021-05-03 12:53:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2021-06-24 10:16:37 +00:00
|
|
|
use Illuminate\Http\Request;
|
2021-06-17 14:08:30 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
2021-06-24 10:16:37 +00:00
|
|
|
use App\Models\{Domain,Setup};
|
2021-06-14 11:33:18 +00:00
|
|
|
|
2021-05-03 12:53:40 +00:00
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
2021-06-14 11:33:18 +00:00
|
|
|
public function network(Domain $o)
|
2021-05-03 12:53:40 +00:00
|
|
|
{
|
2021-06-14 11:33:18 +00:00
|
|
|
return view('domain.view')
|
|
|
|
->with('o',$o);
|
2021-05-03 12:53:40 +00:00
|
|
|
}
|
2021-06-15 12:19:14 +00:00
|
|
|
|
2021-06-17 14:08:30 +00:00
|
|
|
/**
|
|
|
|
* Render a view that summarises the users permissions
|
|
|
|
*/
|
|
|
|
public function permissions()
|
|
|
|
{
|
|
|
|
return view('auth.permissions')
|
|
|
|
->with('user',Auth::user());
|
|
|
|
}
|
|
|
|
|
2021-06-15 12:19:14 +00:00
|
|
|
/**
|
|
|
|
* System Setup
|
|
|
|
*
|
|
|
|
* @note: Protected by Route
|
|
|
|
*/
|
2021-06-24 10:16:37 +00:00
|
|
|
public function setup(Request $request)
|
2021-06-15 12:19:14 +00:00
|
|
|
{
|
2021-06-24 10:16:37 +00:00
|
|
|
$o = Setup::findOrNew(config('app.id'));
|
|
|
|
|
|
|
|
if ($request->post()) {
|
|
|
|
$request->validate([
|
|
|
|
'system_id' => 'required|exists:systems,id',
|
|
|
|
'binkp' => 'nullable|array',
|
|
|
|
'binkp.*' => 'nullable|numeric',
|
|
|
|
'options' => 'nullable|array',
|
|
|
|
'options.*' => 'nullable|numeric',
|
|
|
|
]);
|
|
|
|
|
|
|
|
if (! $o->exists) {
|
|
|
|
$o->id = config('app.id');
|
|
|
|
$o->zmodem = 0;
|
|
|
|
$o->emsi_protocols = 0;
|
|
|
|
$o->protocols = 0;
|
|
|
|
$o->permissions = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$o->binkp = collect($request->post('binkp'))->sum();
|
|
|
|
$o->options = collect($request->post('options'))->sum();
|
|
|
|
$o->system_id = $request->post('system_id');
|
|
|
|
$o->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
return view('setup')
|
|
|
|
->with('o',$o);
|
2021-06-15 12:19:14 +00:00
|
|
|
}
|
2021-05-03 12:53:40 +00:00
|
|
|
}
|