search

Home  >  Q&A  >  body text

Laravel how to turn off timestamps in controller

How to turn off timestamps in the controller?
The closing method of the model is

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class user extends Model {

     //protected $table = 'systems';

     //关闭时间
     public $timestamps = false;
}

What if I change it in the controller? Inject save verse case. . I want to simply write

淡淡烟草味淡淡烟草味2754 days ago518

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 16:57:19

    Although I’m not sure whether this is what the questioner asked, you can try the following:

    $user = User::find(1);
    $user->timestamps = false;
    $user->age = 32;
    $user->save();

    If you have any questions related to Laravel, you can ask me at Laravist. This is the Laravel community I just launched

    reply
    0
  • Cancelreply