MobileInfo.php 565 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. use Yansongda\Supports\Str;
  5. /**
  6. * 配置模型
  7. */
  8. class MobileInfo extends Model
  9. {
  10. protected $type=[
  11. ];
  12. public function mobile(){
  13. return $this->belongsTo(Mobile::class);
  14. }
  15. protected static function init()
  16. {
  17. self::beforeWrite(function (self $info){
  18. if(isset($info['first_month_free']) && !is_numeric($info['first_month_free'])){
  19. $info['first_month_free']=Str::contains($info['first_month_free'],'是')?1:0;
  20. }
  21. });
  22. }
  23. }