45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Live\Anchor;
|
|
use App\Traits\CanCollage;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ConsultAccount extends Model
|
|
{
|
|
use CanCollage;
|
|
protected $fillable = ['merchant_id'];
|
|
public function consulation(){
|
|
return $this->hasone(Consultation::class,'consult_account_id','id');
|
|
}
|
|
|
|
public function merchant()
|
|
{
|
|
return $this->belongsTo(MerchantAccount::class, 'merchant_id', 'id');
|
|
}
|
|
public function anchor()
|
|
{
|
|
return $this->belongsTo(Anchor::class, 'merchant_id', 'm_id');
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|