| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Rome extends Model
- {
- protected $table = 'love_rome';
- protected $fillable = [
- 'uid', 'jid','nid', 'type', 'start','end','name','sex','sort'
- ];
- public function user(){
- return $this->hasOne(Users::class,'id','uid')->select('id','name', 'lid', 'avatar','sex','age','vip','trump','opt','city');
- }
- public function guest(){
- return $this->hasOne(Users::class,'id','jid')->select('id','name', 'lid', 'avatar','sex','age','vip','trump','opt','city');
- }
- public function manuser(){
- return $this->hasOne(Users::class,'id','nid')->select('id','name', 'lid', 'avatar','sex','age','vip','trump','opt','city');
- }
- public function getStartAttribute() {
- return date("Y-m-d H:i:s",$this->attributes['start']);
- }
- public function getEndAttribute() {
- return date("Y-m-d H:i:s",$this->attributes['end']);
- }
- public function applend(){
- return $this->hasMany(UserRomeApply::class,'rid','id');
- }
- public function gifts(){
- return $this->hasMany(UserGifts::class,'rid','id');
- }
- }
|