love_php/app/Models/MerchantInformation.php

49 lines
1.2 KiB
PHP
Raw Normal View History

2026-04-02 09:20:51 +08:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Actuallymab\LaravelComment\Contracts\Commentable;
use Actuallymab\LaravelComment\HasComments;
use App\Traits\Haslike;
use App\Traits\Haslog;
use App\Contracts\Likerable;
use App\Contracts\Logable;
use Illuminate\Database\Eloquent\SoftDeletes;
class MerchantInformation extends Model implements Likerable,Commentable,Logable
{
use HasComments;
use Haslike;
use SoftDeletes;
use Haslog;
protected $guarded = [];
protected $fillable = [];
public function merchant()
{
return $this->belongsTo(MerchantAccount::class, 'merchant_id','id');
}
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;
}
}
}