123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Repositories\Models\Dwbs;
- use App\Repositories\Models\Base\User;
- use App\Repositories\Models\Model;
- class Chengjiu extends Model
- {
- /**
- * @var string
- */
- protected $table = 'user_chengjius';
- protected $guarded = [];
- /**
- * The attributes excluded from the model's JSON form.
- *
- * @var array
- */
- protected $hidden = [];
- protected $casts = [
- 'data' => 'json'
- ];
- protected static function booted()
- {
- parent::booted(); // TODO: Change the autogenerated stub
- //todo:消息提醒
- self::created(function (Chengjiu $model) {
- //兑换提醒
- });
- }
- public function user()
- {
- return $this->belongsTo(User::class)->select(['id', 'nickname', 'headimg', 'mobile', 'mobile_encryption', 'mobile_code']);
- }
- public function getPathAttribute($val)
- {
- if (empty($val)) {
- return config('app.url') . '/default/headimg.png';
- }
- return path_to_url($val);
- }
- }
|