laravel在mongoDb的子文档中插入记录

时间:2019-03-06 11:20:54

标签: mongodb laravel insert

我在MongoDb数据库中有3个子文档

  1. 个人详细信息
  2. companyDetails
  3. bankDetails

这是代码

public function store(Request $request)
{
    $this->validate($request,[
        //Personal Detail
        'firstName' => 'required',
        'middleName' => 'required',
        'lastName' => 'required',
        'dateOfBirth' => 'required',
        'gender' => 'required',
        'mobileNumber' => 'required',
        'localAddress' => 'required',
        'parmanentAddress' => 'required',
        'emailId' => 'required',
        'city' => 'required',

        //Company Detail
        'email' => 'required',
        'password' => 'required',
        'employeeId' => 'required',
        'department' => 'required',
        'designation' => 'required',
        'dateOfJoining' => 'required',
        'salary' => 'required',

        //Bank Detail
        'accountHolderName' => 'required',
        'accountNumber' => 'required',
        'bankName' => 'required',
        'ifscCode' => 'required',
        'panNumber' => 'required',
        'branchName' => 'required'
    ]);

    $employee = new Employee();
}

我在laravel中进行编码,提交表单时,如何在所有3个子文档中插入所有记录?

0 个答案:

没有答案