123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\model;
- use DateTimeInterface;
- use support\Model;
- class CardIssue extends Model
- {
- protected $table = 'card_issue';
- protected $primaryKey = 'card_issue_id';
- protected $dateFormat = 'U';
- const CREATED_AT = 'card_issue_addtimes';
- const UPDATED_AT = null;
- public function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- /**
- * @Desc 关联卡主表
- * @Author Gorden
- * @Date 2024/11/18 11:15
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function main()
- {
- return $this->hasOne(CardMain::class, 'card_main_id', 'join_issue_card_main_id');
- }
- /**
- * @Desc 关联后台用户
- * @Author Gorden
- * @Date 2024/11/18 11:15
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(SysUser::class, 'user_id', 'card_issue_creator_user_id')->select('user_id', 'user_name');
- }
- }
|