AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
当前是BPost表模型: ``` <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use \App\Models\Model; class BPost extends Model { use HasFactory; protected $table = "b_posts"; /* * BPost表文章用户id对应的用户数据 */ public function bUser() { return $this->belongsTo('App\Models\BUser', 'b_user_id', 'id'); } /* * 当前文章的所有分类 */ public function categories() { return $this->belongsToMany(\App\Models\BPostCategory::class, 'b_post_category_relationships', 'b_post_id', 'b_category_id'); // return $this->belongsToMany(\App\Models\BPostCategory::class, 'b_post_category_relationships', 'b_post_id', 'b_category_id')->withPivot(['b_post_id', 'b_category_id']); } /* * 文章是否有分类 */ public function hascategory($category) { return $this->categories->contains($category); } } ```