love_php/app/Models/MerchantShop.php

59 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2026-04-02 09:20:51 +08:00
<?php
namespace App\Models;
use App\Contracts\Collageable;
use App\Contracts\Previewable;
use App\Traits\CanCollage;
use App\Traits\HasPreviews;
use Config;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Contracts\Logable;
use App\Traits\Haslog;
use Actuallymab\LaravelComment\HasComments;
use Actuallymab\LaravelComment\Contracts\Commentable;
use App\Models\Live\Anchor;
class MerchantShop extends Model implements Commentable,Logable,Previewable,Collageable
{
protected $fillable = [];
protected $guarded = [];
use SoftDeletes;
use Haslog;
use HasComments, HasPreviews;
use CanCollage;
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 getIconAttribute($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;
}
}
public function member(){
return $this->hasMany(TouristOrder::class,'type_id','id');
}
}