DB ::选择Laravel和Angular

时间:2018-07-23 07:07:10

标签: php angular laravel eloquent

我正在开发laravel + angular应用程序,在该应用程序中,我试图获取在未来10天内有生日的用户列表。

我已经尝试过了,但是得到了一个空结果集,但是在mysql中,查询给了我结果:

控制器:dashboardData()

$toReturn['bdays'] = array();
DB::SELECT(SELECT * FROM users WHERE DAYOFYEAR(curdate()) <= DAYOFYEAR(from_unixtime(birthday)) AND DAYOFYEAR(curdate()) +10 >= DAYOFYEAR(from_unixtime(birthday)) LIMIT 30;)->get();

查看:

<!-- Birthdays -->
<div class="row" ng-show="dashboardData.bdays">

    <div class="col-12">
        <div class="card">
            <div class="row">
                <div class="col-lg-12">
                    <div class="p-20">
                        <h2 class="font-medium text-inverse">Birthdays</h2>
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center hidden-sm-down">ID</th>
                                    <th>Full Name</th>
                                    <th>Birthday</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="birthday in dashboardData.bdays">
                                    <td class="text-center hidden-sm-down">{{birthday.id}}</td>
                                    <td class="txt-oflo">{{birthday.fullname}}</td>
                                    <td class="hidden-sm-down"><span class="text-success">{{birthday.birthday}}</span></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

我尝试了其他方法,但我一直保持空白。有帮助吗?

注意:我还尝试了DB :: RAW()

0 个答案:

没有答案