小编for*_*edw的帖子

Laravel 与多个自定义数据透视表的多对多关系?

我希望我不是在问一个已经回答的问题,但是使用我能想到的所有搜索词,我无法找到解决方案:

我有两张桌子,companies还有respondents

有时,受访者可以选择一家或多家公司。一个或多个受访者可以选择一家公司。

其他时候,受访者可以评价一个或更多的公司。一家公司可以由一名或多名受访者评分

受访者可以选择评价一家公司。(确实,受访者必须选择所有对其进行评分的公司,但他们并未对他们选择的所有公司进行评分)。

更复杂的是,受访者只是一家公司的员工,而且还被一家或多家公司提名参加评选和评级。

我的思路是有多个自定义枢轴:

//relationship between 'companies' and 'respondents' to show who they selected 
selected_companies 

//relationship between 'companies' and 'respondents' to show who they rated 
rated_companies 

//relationship between 'companies' and 'respondents' to show which companies a respondent was nominated by 
nominating_companies

//relationship between 'companies' and 'respondents' to show who a respondent is employed by
employment
Run Code Online (Sandbox Code Playgroud)

我猜最后一个是简单的一对多,所以我可以employer_id在 …

many-to-many pivot-table laravel eloquent laravel-5

4
推荐指数
1
解决办法
2126
查看次数

Mpdf\Mpdf LoggerAwareInterface 与 php 8.1.12 中的 Psr\Log 不兼容

尝试使用 mpdf 时出现以下错误:

Declaration of Mpdf\Mpdf::setLogger(Psr\Log\LoggerInterface $logger) 
must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void 
Run Code Online (Sandbox Code Playgroud)

我能找到的关于该主题的最多信息是这个,但我找不到如何解决它。

有人提到使用分支php8-support,但我尝试了这个,但它也不起作用。

有人找到解决这个问题的方法吗?

我在 php 上8.1.12并使用"mpdf/mpdf": "v8.0.13"

php mpdf

4
推荐指数
1
解决办法
3750
查看次数

标签 统计

eloquent ×1

laravel ×1

laravel-5 ×1

many-to-many ×1

mpdf ×1

php ×1

pivot-table ×1