Laravel 如何使用Flatter在数据库laragon中插入日期数据?

Laravel 如何使用Flatter在数据库laragon中插入日期数据?,laravel,datetime,flutter,laragon,Laravel,Datetime,Flutter,Laragon,我不知道如何在Flatter应用程序的数据库laragon中插入日期数据。我已经使用软件包“flatter\u datetime\u picker:^1.1.5”完成了插入日期的GUI,但我不知道如何将所选日期数据转发到数据库 我没有选择日期,如下面的代码.dart所示。 我不知道如何将它从数据库连接到api 插入日期.省道 RaisedButton( shape: RoundedRectangleBorder( borde

我不知道如何在Flatter应用程序的数据库laragon中插入日期数据。我已经使用软件包“flatter\u datetime\u picker:^1.1.5”完成了插入日期的GUI,但我不知道如何将所选日期数据转发到数据库

我没有选择日期,如下面的代码.dart所示。 我不知道如何将它从数据库连接到api

插入日期.省道

RaisedButton(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(5.0)),
                elevation: 4.0,
                onPressed: () {
                  DatePicker.showDatePicker(context,
                      theme: DatePickerTheme(
                        containerHeight: 210.0,
                      ),
                      showTitleActions: true,
                      minTime: DateTime(2019, 1, 1),
                      maxTime: DateTime(2030, 12, 31), onConfirm: (date) {
                    print('confirm $date');
                    departDate = '${date.year} - ${date.month} - ${date.day}';
                    setState(() {});
                  }, currentTime: DateTime.now(), locale: LocaleType.en);
                },
                child: Container(
                  alignment: Alignment.center,
                  height: 50.0,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Row(
                        children: <Widget>[
                          Container(
                            child: Row(
                              children: <Widget>[
                                Icon(
                                  Icons.date_range,
                                  size: 25.0,
                                  color: Colors.black.withOpacity(0.5),
                                ),
                               new Text(
                                  // controller: dateDepartController,
                                  " $departDate",
                                  style: TextStyle(
                                      color: Colors.black,
                                      fontWeight: FontWeight.bold,
                                      fontSize: 18.0),
                                ),
                              ],
                            ),
                          )
                        ],
                      ),
                      Text(
                        "  Change",
                        style: TextStyle(
                            color: Colors.black.withOpacity(0.5),
                            fontWeight: FontWeight.bold,
                            fontSize: 18.0),
                      ),
                    ],
                  ),
                ),
                color: Colors.white.withOpacity(0.8),
              ),

我想在数据库的表中更新日期。

首先,laragon是一个Web服务器,而不是API。所以这个问题是无效的。因为你使用的是拉拉贡,我猜你对拉威尔很熟悉。如果您是,您可以在laravel中开发API。如果你想知道如何将数据发布到api,你可以关注这篇文章。你可以在中了解更多关于LaravelAPI的信息,我已经更新了这个问题。这是我尝试过的函数api。
     public function PostTrip(Request $request)
         {
            $id = $request->id;
            $fr_country = $request->fr_country;
            $ar_country = $request->ar_country;
            $traveller_id = $request->taveller_id;
            $departDate = $request->departDate;
            $returnDate = $request->returnDate;

            $getId = User::where('id',$id)->first()->id;
            //// called country based on id ////
            $getFCountry = Countries::where('id',$fr_country)->first()->country;
            $getACountry = Countries::where('id',$ar_country)->first()->country;


             $user = PosTrip::create([
                'fr_country' =>$getFCountry,     
                'ar_country' =>$getACountry,           
                'traveller_id'=>$getId,
                'departDate'=>$departDate,
                'returnDate'=>$returnDate,

            ]);


                $datamsg = response()->json([
                'success' => array("text"=>"Done!")
                ]);
                return $datamsg->content();



         }