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

Merge branch 'task' into journal

# Conflicts:
#	app/Http/Controllers/Users/StudentController.php
#	app/Models/SchoolClass.php
#	app/Models/Teacher.php
#	composer.json
#	composer.lock
#	database/migrations/2020_12_03_104028_create_bank_task_files_table.php
#	routes/api.php
This commit is contained in:
2020-12-16 23:08:17 +07:00
25 changed files with 608 additions and 68 deletions

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tasks', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('banktask_id');
$table->timestamp('deadline')->nullable();
$table->unsignedInteger('teacher_id')->nullable();
$table->unsignedInteger('class_id')->nullable();
$table->timestamps();
$table->foreign('banktask_id')->references('id')->on('bank_tasks')
->onDelete('set null');
// $table->foreign('class_id')->references('id')->on('school_classes')
// ->onDelete('cascade');
// $table->foreign('teacher_id')->references('id')->on('teachers')
// ->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tasks');
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAnswersToTaskTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('answers_to_task', function (Blueprint $table) {
$table->id();
$table->text('description')->nullable();
$table->smallInteger('mark')->nullable();
$table->text('comment_by_teacher')->nullable();
$table->boolean('checked')->default('0');
$table->unsignedInteger('task_id');
$table->unsignedInteger('student_id');
$table->boolean('review')->default('0');
$table->timestamps();
$table->foreign('task_id')->references('id')->on('tasks')
->onDelete('set null');
$table->foreign('student_id')->references('id')->on('students');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('answers_to_task');
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTaskFilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('task_files', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('type');
$table->string('extension');
$table->string('url', 400);
$table->timestamps();
$table->unsignedInteger('task_id');
$table->unsignedInteger('user_id');
$table->foreign('task_id')->references('id')->on('tasks')
->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('task_files');
}
}