<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLaborReportsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('labor_reports', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('enter_number')->index()->comment('进场编号');
            $table->bigInteger('user_workgroup_id')->index()->comment('外键工作组');
            $table->bigInteger('user_id')->index()->comment('外键用户');
            $table->string('name')->index()->comment('临时工名称');
            $table->string('mobile_phone')->nullable()->index()->comment('手机号');
            $table->string('identity_number')->nullable()->index()->comment('身份证号');
            $table->string('labor_company')->nullable()->comment('劳务所');
            $table->timestamp('check_in_at')->nullable()->comment('打卡时间');
            $table->timestamp('verify_at')->nullable()->comment('审核时间');
            $table->bigInteger('group_user_id')->nullable()->index()->comment('审核人id');
            $table->timestamp('check_out_at')->nullable()->comment('退场时间');
            $table->decimal('online_duration')->nullable()->comment('在线时长（小时数）');
            $table->decimal('working_duration')->nullable()->comment('工作时长（小时数）');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('labor_reports');
    }
}
