如何将查询转换为laravel

时间:2019-01-29 09:32:57

标签: laravel eloquent

SELECT *
FROM `digital_useraccess`
left join digital_publisher ON
access_publisher = pub_auto
left join digital_issue ON
issue_publisher = pub_auto
WHERE 1

不使用laravel DB类方法

2 个答案:

答案 0 :(得分:1)

尝试作为参考

abstract class AbstractClass {
    abstract val code: Int
    abstract val url: String?
    abstract val errors: Errors?

    abstract class Errors {
        abstract val messages: List<String>?
    }
}



data class History(
    val data: String?,

    override val code: Int,
    override val url: String?,
    // Do not extend from AbstractClass.Errors here, but Kotlin allows it.
    override val errors: Errors?
) : AbstractClass() {

    // Extend a data class here, then you can use it for 'errors' field.
    data class Errors(
        override val messages: List<String>?
    ) : AbstractClass.Errors()
}

答案 1 :(得分:0)

这可能有帮助:

  ::query()->where('<cplumn>' , '<operator>' ,
 '<value>')->leftJoin('digital_publisher', 'access_publisher',
 '=','pub_auto')->leftJoin('digital_issue', 'issue_publisher', '=',
 'pub_auto')->select('<columns>')->get();/find();/first();