Laravel5.2 uses update to update data. why is created_at updated?

Source: Internet
Author: User
The execution of the function {code...} User. php {code...} is a common update, and the user data already exists. 6.24 update. it seems that the extra value of the crated_at field in the user table is set to null. the onupdateCURRENT_TIMESTAMP previously executes the function.

public function registerStore(Requests\RegisterRequest $request){        $user=User::user();        $res=$user->update($request->all());        return redirect('/');    }

User. php

    protected $fillable = [        'name', 'email', 'password', 'openid','user_id','truename','tel','card','bank_name','bank_branch'    ];    /**     * The attributes excluded from the model's JSON form.     *     * @var array     */    protected $hidden = [        'password', 'remember_token',    ];

It is a common update, and user data already exists.

6.24 update. I will talk about setting the extra value of the crated_at field in the user table to null, which seems to be fine. Previously, it was on update CURRENT_TIMESTAMP.

Reply content:

Execute a function

public function registerStore(Requests\RegisterRequest $request){        $user=User::user();        $res=$user->update($request->all());        return redirect('/');    }

User. php

    protected $fillable = [        'name', 'email', 'password', 'openid','user_id','truename','tel','card','bank_name','bank_branch'    ];    /**     * The attributes excluded from the model's JSON form.     *     * @var array     */    protected $hidden = [        'password', 'remember_token',    ];

It is a common update, and user data already exists.

6.24 update. I will talk about setting the extra value of the crated_at field in the user table to null, which seems to be fine. Previously, it was on update CURRENT_TIMESTAMP.

It seems that someone else has encountered this problem: https://github.com/laravel/framework/issues/11518

ZookeepermigrationTime

$table->timestamp('created_at')->useCurrent();$table->timestamp('updated_at')->useCurrent();

Or

$table->nullableTimestamps();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.