Changed to using new Address Model, Implemented Setup, Some minor CSS changes

This commit is contained in:
Deon George
2021-06-24 20:16:37 +10:00
parent ec6594b701
commit d1ca78d372
33 changed files with 766 additions and 172 deletions

View File

@@ -2,9 +2,10 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\Domain;
use App\Models\{Domain,Setup};
class HomeController extends Controller
{
@@ -28,8 +29,34 @@ class HomeController extends Controller
*
* @note: Protected by Route
*/
public function setup()
public function setup(Request $request)
{
return view('setup');
$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);
}
}