FEATURE: add possibilityy to upload and assign files to content pages

This commit is contained in:
Michal Kváček
2016-07-29 01:22:49 +02:00
parent 790cc772a9
commit 0d5e6d4133
14 changed files with 275 additions and 28 deletions
@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AssignFilesToPages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contents_has_files', function (Blueprint $table) {
$table->integer('content_id');
$table->integer('file_id');
$table->primary(['content_id', 'file_id']);
$table->foreign('content_id')
->references('id')
->on('contents')
->onDelete('cascade')
->onUpdate('cascade');
$table->foreign('file_id')
->references('id')
->on('files')
->onDelete('cascade')
->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('contents_has_files');
}
}