更新代码
This commit is contained in:
44
app/Models/ActivityLog.php
Normal file
44
app/Models/ActivityLog.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use RuLong\Order\Models\Order;
|
||||
|
||||
class ActivityLog extends Model
|
||||
{
|
||||
|
||||
protected $dates = [
|
||||
'used_at',
|
||||
];
|
||||
|
||||
public function activity()
|
||||
{
|
||||
return $this->belongsTo(Activity::class)->withDefault();
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class)->withDefault();
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(Order::class)->withDefault();
|
||||
}
|
||||
|
||||
public function sanuser()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'id', 'san_people_id')->withDefault();
|
||||
}
|
||||
|
||||
public function getStatusTextAttribute()
|
||||
{
|
||||
if ($this->used_at == '') {
|
||||
return '<span style="color:blue">未使用</span>';
|
||||
} elseif ($this->used_at) {
|
||||
return '<span style="color:green">已使用</span>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user