为什么新增数据的created_at没有自动维护
class Student extends Model
{
protected $table = 'student';
public $timestamps = true;
protected function getDateFromat()
{
return time();
}
protected function asDateTime($val)
{
return $val;
}
}
public function save(Request $request)
{
$data = $request->input('Student');
//var_dump($data);
$students = new Student();
$students->name = $data['name'];
$students->age = $data['age'];
$students->sex = $data['sex'];
//$student->save();
if($students->save()){
return redirect('student/index');
}else{
return redirect()->back();
}
}