Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
database
/
migrations
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUploadsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('uploads', function (Blueprint $table) { $table->increments('id'); $table->string('filename'); $table->string('extention'); $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users') ->onUpdate('cascade')->onDelete('cascade'); $table->softDeletes(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('uploads',function($table){ $table->dropForeign(['user_id']); }); Schema::dropIfExists('uploads'); } }