提交代码
This commit is contained in:
56
app/Models/Card.php
Normal file
56
app/Models/Card.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Card extends Model
|
||||
{
|
||||
protected $casts = [
|
||||
'source' => 'array',
|
||||
];
|
||||
protected $dates = [
|
||||
'actived_at',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(CardOrder::class);
|
||||
}
|
||||
|
||||
public function activeUser()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'active_id');
|
||||
}
|
||||
|
||||
public function getStatusTextAttribute()
|
||||
{
|
||||
switch ($this->status) {
|
||||
case 0:
|
||||
return '禁用';
|
||||
break;
|
||||
case 1:
|
||||
return '可用';
|
||||
break;
|
||||
case 2:
|
||||
return '待发货';
|
||||
break;
|
||||
case 3:
|
||||
return '已发货';
|
||||
break;
|
||||
case 4:
|
||||
return '已收货';
|
||||
break;
|
||||
case 5:
|
||||
return '已激活';
|
||||
break;
|
||||
default:
|
||||
return '无';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user