小编Ruc*_*chi的帖子

在where子句中使用case语句的laravel查询在条件后追加IS NULL

->where([
         'er.id_user_request_to' => $nIdUser
       ])
->where(DB::raw('case WHEN ge.id_user IS NOT NULL THEN ge.id_user = '.$nIdUser.' ELSE 0 END'))
Run Code Online (Sandbox Code Playgroud)

尝试使用以下代码打印查询

$qry = vsprintf(str_replace(array('%', '?'), array('%%', '"%s"'), $oEvents->toSql()), $oEvents->getBindings());
dd($qry);
Run Code Online (Sandbox Code Playgroud)

这会打印一个查询,如

WHERE
(
    `er`.`id_user_request_to` = "6") 
    AND(
         CASE WHEN ge.id_user IS NOT NULL THEN ge.id_user = 6 ELSE 0 END
       )
) **IS NULL**
Run Code Online (Sandbox Code Playgroud)

没有从它在查询结束时添加IS NULL 的地方获取

mysql laravel eloquent

3
推荐指数
1
解决办法
1976
查看次数

以纯文本形式获取降价电子邮件

我正在使用 laravel Mailable 和 Markdown 发送电子邮件,但它发送了一封如下所示的电子邮件,没有得到我做错了什么。

Hello cus1
    Please click the button below to verify your email address.

    <table class="action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
    <tr>
        <td align="center">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
                <tr>
                    <td align="center">
                        <table border="0" cellpadding="0" cellspacing="0" role="presentation">
                            <tr>
                                <td>
                                    <a href="https://google.com" class="button button-primary"
                                       target="_blank">Verify Email Address</a>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

    If you did not create an account, no further action is required.

    Thanks,<br>
    PMS
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

下面是我welcome_email.blade.php用来生成电子邮件模板的

@component('mail::message')
    # Hello {{ …
Run Code Online (Sandbox Code Playgroud)

markdown lumen

2
推荐指数
1
解决办法
680
查看次数

标签 统计

eloquent ×1

laravel ×1

lumen ×1

markdown ×1

mysql ×1