From f0132bee2c27dec590d6921860ebc0e127f463b3 Mon Sep 17 00:00:00 2001 From: Vedde Date: Tue, 30 Jun 2020 11:27:39 +0200 Subject: [PATCH] worked on ResourceExtensionController.php and added resource_extension migration --- .../ResourceExtensionController.php | 5 ++- ...6_30_092130_create_resource_extensions.php | 33 +++++++++++++++++++ skolehjem/routes/web.php | 1 + 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 skolehjem/database/migrations/2020_06_30_092130_create_resource_extensions.php diff --git a/skolehjem/app/Http/Controllers/ResourceExtensionController.php b/skolehjem/app/Http/Controllers/ResourceExtensionController.php index e5136e2..422ecc5 100644 --- a/skolehjem/app/Http/Controllers/ResourceExtensionController.php +++ b/skolehjem/app/Http/Controllers/ResourceExtensionController.php @@ -50,9 +50,8 @@ class ResourceExtensionController extends Controller public function store(Request $request) { $requestBody = $request->validate([ - "name" => "required|unique:events|max:255", - "description" => "required|max:255", - "date" => "required" + "extension" => "unique|required|max:255", + "description" => "required|max:255" ]); $event = new ResourceExtension($requestBody); diff --git a/skolehjem/database/migrations/2020_06_30_092130_create_resource_extensions.php b/skolehjem/database/migrations/2020_06_30_092130_create_resource_extensions.php new file mode 100644 index 0000000..3f1abb5 --- /dev/null +++ b/skolehjem/database/migrations/2020_06_30_092130_create_resource_extensions.php @@ -0,0 +1,33 @@ +id(); + $table->string("extension")->unique(); + $table->text("description"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('resource_extensions'); + } +} diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index ce578ac..b371e91 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -38,3 +38,4 @@ Route::resource("washing-machines", "WashingMachineController"); Route::resource("washing-reservations", "WashingReservationController"); Route::resource("feedbacks", "FeedbackController"); Route::resource("external-links", "ExternalLinkController"); +Route::resource("resource-extensions", "ResourceExtensionController");