| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Models;
- use App\Models\BaseModel;
- use Illuminate\Database\Eloquent\SoftDeletes;
- /**
- * @description 抵扣卡列表
- * @author system;
- * @version 1.0
- * @date 2018-07-12 08:35:58
- *
- */
- class CardInfoModel extends BaseModel
- {
- use SoftDeletes;
- /**
- * 数据表名
- *
- * @var string
- *
- */
- protected $table = 'card_info';
- /**
- * 主键
- */
- protected $primaryKey = 'id';
- //分页
- protected $perPage = PAGE_NUMS;
- /**
- * 可以被集体附值的表的字段
- *
- * @var string
- */
- protected $fillable = [
- 'card_no',
- 'status',
- 'user_id',
- 'remark',
- 'end_time',
- 'product_id',
- 'qrcode',
- 'used_at'
- ];
- public function status(){
- switch ($this->status){
- case 1:
- return '已激活';
- break;
- case 2:
- return '已核销';
- break;
- default:
- return '未激活';
- break;
- }
- }
- public function product(){
- $product = (new ProductInfoModel())->whereIn('id',explode(',',$this->product_id))->pluck('name');;
- return $product;
- }
- }
|