ChatgptOrder.php 515 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Model;
  3. use Illuminate\Database\Eloquent\Model;
  4. class ChatgptOrder extends Model
  5. {
  6. protected $table = "jm_chatgpt_order";
  7. public $timestamps = false;
  8. /**
  9. * 追加字段
  10. */
  11. protected $appends = [
  12. 'mobile'
  13. ];
  14. /**
  15. * 用户手机号
  16. */
  17. public function getMobileAttribute($value)
  18. {
  19. $value = $this->attributes['uid'] ?? '';
  20. $user = User::where('uid' , $value)->first();
  21. return $user->phone ?? '---';
  22. }
  23. }