dongmu7335
dongmu7335
2017-04-11 05:13

当我尝试使用laravel中的datepicker更新日期字段时,在数据库中更新空白日期

  • laravel
  • php
  • datepicker
  • jquery

When I try to update my form with date field having jquery datapicker it store empty value on my database so the date field not updated in my form ..I am using date datatype in database for date field..

I added this in html field

<input type="text" id="datepicker" value="{{ old('datetime', $site->datatime) }}" name="datatime">

This is inside my controller

$site->update([
            'name'=>$request['name'],
            'copyright'=> $request['copyright'],
            'is_active'=>$request['status'] == 'true' ? 1 : 0,
            'message'=>$request['message'],
            'datatime'=>$request['datetime'],
            'url'=>$request['url'],
            'metadata'=>$request['metadata']

        ]);
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答