qq_春秋入我心_gjpv16
2018-10-20 18:55
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();
}
}
getDateFromat改getDateFormat
protected function getDateFromat() 改成 public function getDateFromat() 试试?
轻松学会Laravel-表单篇
32653 学习 · 255 问题
相似问题