updated controller

This commit is contained in:
Vedde 2020-06-25 09:15:21 +02:00
parent ccddf4d2f3
commit 27b4f48af2
2 changed files with 16 additions and 6 deletions

View File

@ -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");
}
}

View File

@ -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');
}
}