Laravel不保存,但返回true

gdf*_*dfg 0 laravel laravel-5

我在控制器中使用最新的Laravel和以下代码:

function changeProperty(Request $request){

    if(Car::find('id', 34)->save(array('expired' => true))){
        return [
            'success' => true,
            'check' => Car::find(34)
        ];
    }

    return [
        'success' => false
    ];
}
Run Code Online (Sandbox Code Playgroud)

我得到了success => true,但是当我签入PHPMyAdmin时,该值未保存。在中,Property::find(34)我看到Car被选中,但也没有更新值expired,默认情况下为0。

这是Car模型的一部分:

protected $fillable = [
    'expired'
];
Run Code Online (Sandbox Code Playgroud)

这是cars表的迁移:

    public function up()
{
    Schema::create('cars', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('name');
        $table->boolean('expired')->default(false);
        $table->timestamps();
    });
}
Run Code Online (Sandbox Code Playgroud)

lev*_*evi 5

应该:

Car::find('id', 34)->update($params)
Run Code Online (Sandbox Code Playgroud)

save() 不接受属性作为参数。