From 2abdf25c45d88e892e089f388b198d67d45c44fa Mon Sep 17 00:00:00 2001 From: cp6 Date: Sat, 19 Feb 2022 23:42:59 +1100 Subject: [PATCH] Created OS route and controller Created OS route and controller --- app/Http/Controllers/OsController.php | 44 +++++++++++++++++++++++++++ routes/web.php | 2 ++ 2 files changed, 46 insertions(+) create mode 100644 app/Http/Controllers/OsController.php diff --git a/app/Http/Controllers/OsController.php b/app/Http/Controllers/OsController.php new file mode 100644 index 0000000..f03ef2a --- /dev/null +++ b/app/Http/Controllers/OsController.php @@ -0,0 +1,44 @@ +validate([ + 'name' => 'required|min:2' + ]); + + OS::create([ + 'name' => $request->os_name + ]); + + return redirect()->route('os.index') + ->with('success', 'OS Created Successfully.'); + } + + public function destroy(OS $OS) + { + $items = OS::find($OS->id); + + $items->delete(); + + return redirect()->route('os.index') + ->with('success', 'OS was deleted Successfully.'); + } +} diff --git a/routes/web.php b/routes/web.php index 0a2ca25..ce50672 100644 --- a/routes/web.php +++ b/routes/web.php @@ -46,6 +46,8 @@ Route::resource('locations', LocationsController::class)->middleware(['auth']); Route::resource('misc', MiscController::class)->middleware(['auth']); +Route::resource('os', OsController::class)->middleware(['auth']); + Route::resource('providers', ProvidersController::class)->middleware(['auth']); Route::resource('reseller', ResellerController::class)->middleware(['auth']);