在浏览互联网和此处后,我没有找到对我有用的东西。我目前正在创建一个CRUD。每个“企业”都有一个或多个“站点”,我目前正在为站点做CRUD。我是通过执行make:form命令来实现的。当我要创建一个站点时出现以下错误:CatchableFatalError:ObjectofclassApp\Entity\Entreprisecouldnotbeconvertedtostring如我所见,我已尝试添加函数__toString()。但也许我没有正确地添加它,它没有任何改变,所以我删除了它。我创建网站的Controller如下所示:/***@Route("admin/sites/new",n
我想在Intranet中制作一个搜索引擎。现在我在PHP中使用这个子句。$k=explode("",$_GET[key]);$sql="selectentreprise.*,employee.*whereentreprise.*oremployee.*like'%$k[0]%'or'%$k[1]%'";但是好像不行。你知道错在哪里吗?提前致谢。编辑:$sql="select*fromentreprise,site,salariewhereentreprise.*,site.*,salarie.*like'%$k[0]%'or'%$k[1]%'";我修改了查询子句。有了这段代码,我想你可
whereHas方法似乎不太有效。$res=Entreprise::whereHas('labels',function($q){$q->where('hidden','!=',1);})->whereHas('labels',function($q){$q->whereHidden(1);})->get();dd(count($res));//showsint2这是标签关系:publicfunctionlabels(){return$this->morphToMany('Label','labelable');}这是数据库:id|nom|deleted_at|created_at|u