1
0
mirror of https://github.com/robonen/education-project.git synced 2026-03-20 02:44:31 +00:00

Создание, обновление, получение, фильтрация

This commit is contained in:
nikden13
2020-12-04 11:09:57 +07:00
parent 4a8e802c03
commit 45bec16c7f
7 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTimetablesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('timetables', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('class_id');
$table->unsignedInteger('teacher_id');
$table->unsignedInteger('subject_id');
$table->date('date');
$table->time('time_start');
$table->time('time_end');
$table->string('classroom');
$table->timestamps();
$table->foreign('class_id')
->references('id')->on('school_classes')
->onDelete('cascade');
$table->foreign('teacher_id')
->references('id')->on('teachers')
->onDelete('set null');
$table->foreign('subject_id')
->references('id')->on('subjects')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('timetables');
}
}