3 回答
TA贡献1850条经验 获得超11个赞
在 RegisterController 里面创建函数
$user= User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
//UserData is the Model of user_data table
$user->UserData->create(['job'=>$data['job']]);
return $user
TA贡献1826条经验 获得超6个赞
试试这个例子:
use Illuminate\Support\Facades\DB;
$user_data= array(
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
);
$role_data= array(
'user_name' => $data['name'],
'email' => $data['email']
);
$response = DB::table('users')->insert($user_data);
$response = DB::table('role')->insert($role_data);
- 3 回答
- 0 关注
- 157 浏览
添加回答
举报