53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models\Server;
|
|
|
|
use App\Models\MerchantTags;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Traits\HasRewards;
|
|
use App\Contracts\Rewardable;
|
|
use App\Models\Live\Anchor;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class MerchantInformation extends Model implements Rewardable
|
|
{
|
|
use HasRewards;
|
|
use SoftDeletes;
|
|
protected $guarded = [];
|
|
protected $fillable = [];
|
|
|
|
public function merchant()
|
|
{
|
|
return $this->belongsTo(MerchantAccount::class, 'merchant_id', 'id');
|
|
}
|
|
|
|
public function anchor()
|
|
{
|
|
return $this->belongsTo(Anchor::class, 'merchant_id', 'm_id')->select('id','m_id','name');
|
|
}
|
|
|
|
public function tag()
|
|
{
|
|
return $this->belongsTo(MerchantTags::class, 'tag_id', 'id')->select('id','name');
|
|
}
|
|
|
|
public function getPicAttribute($value)
|
|
{
|
|
if ($this->merchant_id == 491) {
|
|
if ($value) {
|
|
if (!strpos('local-pictures', $value) && !strpos($value, 'x-oss-process')) {
|
|
return $value . Config('image.watermark');
|
|
} else {
|
|
return $value;
|
|
}
|
|
} else {
|
|
return $value;
|
|
}
|
|
}else{
|
|
return $value;
|
|
}
|
|
|
|
}
|
|
}
|