舉個(gè)簡(jiǎn)單的例子laravel框架中的migration功能class Blueprint中集成了一個(gè)function timestamps 可以為數(shù)據(jù)庫(kù)添加兩個(gè)字段,不過會(huì)使用數(shù)據(jù)庫(kù)格式為timestamp,想要改造一下這個(gè)function,例如我想要修改成如下:public function timestamps($precision = 0)
{ $this->integer('created_at')->nullable(); $this->integer('updated_at')->nullable(); //或集成其他字段
}我嘗試過1.在class Blueprint中直接改,但是考慮到下次的composer update 就會(huì)將這個(gè)修改覆蓋掉。2.寫一個(gè)繼承,在繼承內(nèi)重構(gòu)這個(gè)function,但是在執(zhí)行 make:migation時(shí)報(bào)錯(cuò)3.之前看到一個(gè)方法 用trial insteadof 不過好像得是 Blueprint 同為 trail才可以想請(qǐng)問一下大家有什么方法可以解決!
laravel框架如何對(duì)vendor內(nèi)部的class重構(gòu)
慕工程0101907
2019-03-15 13:03:04