我想从posts表中获取一些行。我使用eloquant,而且我不知道该怎么做。
我有五个表:
posts-reviews
或specs
)和post_table
)我想从 suspended_users
中跳出这三个表。
然后我尝试在Suspect模型的内部。
但是不起作用!
$this->join("post_translations as pt", "pt.id", "=", "suspended_users.article_id")
->join($this->post_type." as p", "p.id", "=", "post_translations.post_id")
->select($this->post_type.".*")
->get();
答案 0 :(得分:0)
您可以尝试使用DB::raw
功能。试试这个:
$this->join(\DB::raw("post_translations as pt"), "pt.id", "=", "suspended_users.article_id")
->join(\DB::raw($this->post_type." as p"), "p.id", "=", "post_translations.post_id")
->select($this->post_type.".*")
->get();
答案 1 :(得分:0)
您应该尝试以下操作:
$this->select("p.*")->join("post_translations as pt", "pt.id", "=", "suspended_users.article_id")
->join($this->post_type." as p", "p.id", "=", "post_translations.post_id")
->get();