generated from panliang/owl-admin-starter
29 lines
531 B
PHP
29 lines
531 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Traits\HasDateTimeFormatter;
|
|
|
|
/**
|
|
* 支部排名
|
|
*/
|
|
class CateRank extends Model
|
|
{
|
|
use HasDateTimeFormatter, Filterable;
|
|
|
|
protected $table = 'cate_rank';
|
|
protected $fillable = ['sn', 'cate_id', 'score'];
|
|
|
|
public function cate()
|
|
{
|
|
return $this->belongsTo(PartyCate::class, 'cate_id');
|
|
}
|
|
|
|
public function scopeSort($q)
|
|
{
|
|
$q->orderBy('sn')->orderBy('score', 'desc');
|
|
}
|
|
}
|