本文介紹了Laravel Eloquent ORM 返回 stdClass 而不是實際模型的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在做
$mymodel = MyModel::where( 'url', $domain )->first();
這是返回一個 MyModel 對象,現在不知何故,它正在返回一個 stdClass.
and this was returning a MyModel object and now, somehow, it is returning a stdClass.
發生了什么事?Laravel 有什么更新嗎?我改變了什么嗎?
What's happening? Is it some update on the laravel? Have I changed something?
謝謝
推薦答案
發現問題.我今天確實更新了 laravel,它正在更新到開發版本.作為開發人員,它可能有錯誤,而且確實如此.我只是回滾到版本4.1.22",它工作正常.
Found the problem. I did updated the laravel today and it was updating to a dev version. By being dev it could have bugs and it did. I just rollback to version "4.1.22" and it's working fine.
這篇關于Laravel Eloquent ORM 返回 stdClass 而不是實際模型的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!