user()->project_ids; if ($ids) { $split = (new CommonModel())->split; $ids = explode($split, $ids); $query->whereIn('id', $ids); } } public function getLogoUrlAttribute() { $protocol = request()->secure() ? "https" : "http"; return $this->logo ? $protocol . "://" . request()->getHost() . $this->logo : $this->logo; } public function getBannersUrlAttribute() { $protocol = request()->secure() ? "https" : "http"; return $this->banners ? $protocol . "://" . request()->getHost() . $this->banners : $this->banners; } public function buildings() { return $this->hasMany(Building::class); } public function areas() { return $this->hasMany(Area::class, Building::class); } public function paramedicLevels() { return $this->hasMany(ParamedicLevel::class); } public function products() { return $this->hasMany(Product::class, "project_id", "id"); } public function defaultProduct() { return $this->hasOne(Product::class, "project_id", "id"); } public function managers() { return $this->hasManyThrough(Manager::class, ManagerProject::class, "project_id", "id", "id", "manager_id"); } public function wechatpayAccount() { return $this->hasOne(WechatpayAccount::class, "id", "wechatpay_account_id")->withTrashed(); } public function alipayAccount() { return $this->hasOne(AlipayAccount::class, "id", "alipay_account_id")->withTrashed(); } }