1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Model;
- use Illuminate\Database\Eloquent\Model;
- class ChatgptOrder extends Model
- {
- protected $table = "jm_chatgpt_order";
- public $timestamps = false;
- /**
- * 追加字段
- */
- protected $appends = [
- 'mobile'
- ];
- /**
- * 用户手机号
- */
- public function getMobileAttribute($value)
- {
- $value = $this->attributes['uid'] ?? '';
- $user = User::where('uid' , $value)->first();
- return $user->phone ?? '---';
- }
- }
|