love_php/app/Models/QATest.php

61 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2026-04-02 09:20:51 +08:00
<?php
namespace App\Models;
use App\Models\Server\QrCode;
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 QATest extends Model implements Logable,Commentable
{
protected $fillable = [];
protected $guarded = [];
use Haslog;
use HasComments;
use SoftDeletes;
public function answer()
{
return $this->hasMany(QAAnswer::class);
}
public function record()
{
return $this->hasMany(QATestRecord::class);
}
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($value){
if(!strpos('local-pictures',$value)&&!strpos($value,'x-oss-process')){
return $value.Config('image.watermark');
}else{
return $value;
}
}else{
return $value;
}
}
public function qrcode()
{
return $this->hasOne(QrCode::class, 'type_id', 'id');
}
}