【问题标题】:pass array via session and fetch information based on it通过会话传递数组并基于它获取信息
【发布时间】:2018-10-07 07:12:01
【问题描述】:

在一个页面上,我想在数据库中存储一个动态表单,在下一页上,我将列出这些项目,基于此,我有另一个表单要记录在表中。 但是当我这样做时,我有一个错误。我的源代码和错误如下。请指导我。 谢谢。

【问题讨论】:

    标签: forms session view controller laravel-5.6


    【解决方案1】:

    我的问题通过插入行解决,然后获取最后一条记录并插入到变量中。

    DB::table('travelers')->insert([
    'faName' => $this->first_name[$i],
    'faFamily' => $this->last_name[$i],
    'fatherName' => $this->father_name[$i],
    'nationalCode' => $this->national_code[$i],
    'phone' => $this->phone_number[$i],
    'enName' => $this->e_first_name[$i],
    'enFamily' => $this->e_last_name[$i],
    'email' => $this->email[$i],
    'passportNumber' => $this->passport_number[$i],
    'expDate' => CustomDateTime::toGreg($this->passport_expire_date[$i]),
    'birthDay' => CustomDateTime::toGreg($this->birthday[$i]),
    'foreigner' => $foreignerField
    

    ]); $traveler = DB::table('travelers')->orderBy('id', 'desc')->first();

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多