diff --git a/skolehjem/app/Http/Controllers/ExternalLinkController.php b/skolehjem/app/Http/Controllers/ExternalLinkController.php index afd74b9..af6218b 100644 --- a/skolehjem/app/Http/Controllers/ExternalLinkController.php +++ b/skolehjem/app/Http/Controllers/ExternalLinkController.php @@ -70,7 +70,8 @@ class ExternalLinkController extends Controller */ public function edit($id) { - // + $link = ExternalLink::find($id); + return Response::detect("external-links.edit", ["externallink" => $link]); } /** @@ -82,7 +83,15 @@ class ExternalLinkController extends Controller */ public function update(Request $request, $id) { - // + $data = $request->validate([ + "name" => "", + "link" => "" + ]); + + $id->update($data); + $id->save(); + + return Response::detect("external-links.update"); } /** @@ -93,6 +102,7 @@ class ExternalLinkController extends Controller */ public function destroy($id) { - // + $id->delete(); + return Response::detect("external-links.destroy"); } } diff --git a/skolehjem/database/migrations/2020_06_08_085209_create_external_link.php b/skolehjem/database/migrations/2020_06_24_064840_create_external_links.php similarity index 75% rename from skolehjem/database/migrations/2020_06_08_085209_create_external_link.php rename to skolehjem/database/migrations/2020_06_24_064840_create_external_links.php index 822a735..dc72ec1 100644 --- a/skolehjem/database/migrations/2020_06_08_085209_create_external_link.php +++ b/skolehjem/database/migrations/2020_06_24_064840_create_external_links.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateExternalLink extends Migration +class CreateExternalLinks extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateExternalLink extends Migration */ public function up() { - Schema::create('external_link', function (Blueprint $table) { + Schema::create('external_links', function (Blueprint $table) { $table->id(); $table->string("name"); $table->string("link"); @@ -28,6 +28,6 @@ class CreateExternalLink extends Migration */ public function down() { - Schema::dropIfExists('external_link'); + Schema::dropIfExists('external_links'); } }