<?php

namespace App\Modules\Book\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class RententionBookList extends Model
{
    protected $table = 'rentention_book_list';

    protected $fillable = [
        'bid',
        'book_name',
        'type',
        'type_generate_time',
        'is_deleted',
        'sex',
        'is_updated',
        'updated_time',
        'arpu',
    ];

    public static function createTable()
    {
        if (!Schema::hasTable('rentention_book_list')) {
            Schema::create('rentention_book_list', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('bid');
                $table->string('book_name', 255);
                $table->integer('type');
                $table->dateTime('type_generate_time');
                $table->boolean('is_deleted');
                $table->timestamps();
                $table->index(['bid'], 'idx_bid');
            });
        }
    }
}
