0
我使用的是軟刪除我的模特工作,並在某些情況下,我通過這樣的withTrashed()不上服務器
public function team()
{
return $this->belongsTo(Team::class)->withTrashed();
}
問題關係查詢刪除模式是,在我的地方env(laravel homestead)一切都很好,但是這個關係在主機上返回null。
當我嘗試調試SQL查詢本地版本看起來像這樣
select * from `teams` where `teams`.`id` in (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?)
Server版本看起來像這樣
select *
from `teams`
where `teams`.`id` in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
and `teams`.`deleted_at` is null
什麼是「託管」?確保服務器上的代碼實際上是你認爲的。你有不同的配置文件嗎? – Relequestual
「託管」是https://hostinguk.net/上的開發服務器,代碼在本地和託管上是相同的。認爲配置不是問題,因爲我實際上有不同的數據庫查詢 –
在這種情況下,您需要與您的託管服務提供商交談。不知道您的本地環境與託管環境有什麼不同,任何人都不可能複製問題或提供解決方案。 – Relequestual