ReceiveAddress.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Module\System\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. /**
  7. * field start
  8. * @property int $id
  9. * @property string $name 地址
  10. * @property int $status 状态
  11. * @property string $address 地址
  12. * @property \Carbon\Carbon $created_at 创建时间
  13. * @property \Carbon\Carbon $updated_at 更新时间
  14. * @property \Carbon\Carbon $deleted_at 删除时间
  15. * field end
  16. */
  17. class ReceiveAddress extends Model
  18. {
  19. //attrlist start
  20. protected $fillable = [
  21. 'id',
  22. 'name',
  23. 'status',
  24. 'address',
  25. ];
  26. // attrlist end
  27. use HasDateTimeFormatter;
  28. use SoftDeletes;
  29. protected $table = 'receive_address';
  30. /**
  31. * @return \Illuminate\Database\Eloquent\Collection
  32. * 随机获取系统地址
  33. */
  34. public static function getAddress()
  35. {
  36. $query = static::query();
  37. return $query->inRandomOrder()->limit(1)->first();
  38. }
  39. }