<?php

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

class CreateNotificationsTable extends Migration
{

    protected $casts = [
        'count' => 'array'
    ];
    public $set_schema_table = 'notifications';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create($this->set_schema_table,function($table){
            $table->increments('id');
            $table->integer('eventlogs_id')->nullable()->unsigned();
            $table->string('type')->nullable();
            $table->integer('user_to')->nullable()->unsigned();
            $table->integer('is_delivered')->nullable();
            $table->integer('is_read')->nullable();
            $table->integer('is_archived')->nullable();
            $table->text('array_users')->nullable();
            $table->foreign('eventlogs_id')->references('id')->on('eventlogs')->onDelete('set null');
            $table->foreign('user_to')->references('id')->on('users')->onDelete('set null');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropIfExists($this->set_schema_table);
    }
}
