love_php/app/Models/Consultation.php
2026-04-02 09:20:51 +08:00

43 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use App\Contracts\Collageable;
use App\Contracts\Previewable;
use App\Traits\CanCollage;
use App\Traits\HasPreviews;
use Illuminate\Database\Eloquent\Model;
use App\Models\ConsultAccount;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Contracts\Logable;
use App\Traits\Haslog;
use Actuallymab\LaravelComment\HasComments;
use Actuallymab\LaravelComment\Contracts\Commentable;
class Consultation extends Model implements Logable,Commentable,Previewable,Collageable
{
use Haslog;
use SoftDeletes;
use HasComments, HasPreviews;
use CanCollage;
public function teacher(){
return $this->hasOne(ConsultAccount::class,'id','consult_account_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 member(){
return $this->hasMany(TouristOrder::class,'type_id','id');
}
}