<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;

class TgComm extends Model
{
    // 显式指定表名
    protected $table = 'tg_comm';
    protected $guarded = ['id'];

    //将所有的指令转换成数组文字档
    public static function TgComm2Arr(){
        $data = tg_comm::all()->toArray();
        $export = '<?php return ' . var_export($data, true) . ';';
        Storage::disk('dataconfig')->put('TgComm.php', $export);
    }

}
