increments('id'); $table->string('original_name'); $table->string('filename'); $table->string('mime_type')->index(); $table->string('model')->index(); $table->boolean('is_preview' )->default(false)->index(); $table->integer('model_id')->unsigned()->nullable(); $table->foreign('model_id')->references('id')->on('posts'); $table->integer('user_id')->unsigned()->nullable(); $table->foreign('user_id')->references('id')->on('users'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('documents'); } }