Eloquent find(2) 返回错误记录

Ryd*_*pro 2 php laravel eloquent

$wire = Wire::find(2)->value('options'); var_dump($wire); die();

退货 string(39) "{"note": "wire one", "value": "WIRE 1"}

这些是我的 2 个数据库条目。

1   {"note": "wire one", "value": "WIRE 1"} WIRE ONE    2017-01-29 01:37:49 2017-01-29 01:37:49
2   {"note": "wire two", "value": "WIRE 2"} WIRE TWO    2017-01-29 01:38:19 2017-01-29 01:38:19
Run Code Online (Sandbox Code Playgroud)

为什么 find(2) 返回记录 #1 的值?

我在另一个 Laravel 应用程序中认识到了这一点。这是在一个新的 Laravel 应用程序中完成的。

Ryd*_*pro 5

看起来像用 ->value 或 ->get 详细说明 find() 方法运行一个全新的查询。

Wire::find(2)->get(); 运行检索所有模型的新查询。

Wire::find(2); 按主键 2 返回模型。