<?php namespace App\Model; use Illuminate\Database\Eloquent\Model; use Request; use Excel; use DB; class UserAmountModel extends Model { protected $connection = 'order'; protected $table = 'lie_user_amount'; protected $guarded = ['amount_id']; protected $primaryKey = 'amount_id'; public $timestamps = true; const CREATED_AT = 'create_time'; const UPDATED_AT = 'update_time'; public function fromDateTime($value) { return strtotime(parent::fromDateTime($value)); } // 获取排名前十的用户总额 public function getUserAmount() { return $this->select('amount_id', 'user_id', 'account', 'amount')->orderBy('amount', 'desc')->take(10)->get()->toArray(); } }