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

45 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use App\Models\CommunityActivity;
use App\Models\Consultation;
use App\Models\Course\Course;
use App\Models\MerchantShop;
use App\Models\MerchantInformation;
use Illuminate\Database\Eloquent\Model;
class Questionnaire extends Model
{
protected $fillable = [];
protected $guarded = [];
public function activity(){
return $this->hasOne(CommunityActivity::class, 'id', 'type_id')->where('class','=', 'one')->withTrashed();;
}
public function service(){
return $this->hasOne(CommunityActivity::class, 'id', 'type_id')->where('class', '=','many')->withTrashed();;
}
public function activityService()
{
return $this->hasOne(CommunityActivity::class, 'id', 'type_id')->withTrashed();
}
public function course(){
return $this->hasOne(Course::class, 'id', 'type_id')->withTrashed();
}
public function consult(){
return $this->hasOne(Consultation::class, 'id', 'type_id')->withTrashed();
}
public function shop(){
return $this->hasOne(MerchantShop::class, 'id', 'type_id')->withTrashed();
}
public function information(){
return $this->hasOne(MerchantInformation::class,'id','type_id')->withTrashed();
}
}