DB ::事务(功能()使用($请求)在laravel控制器中不起作用

时间:2019-06-17 07:44:38

标签: database laravel

只要触发此方法,就不执行DB::transaction(function () use ($request)中的代码

完整的代码在这里

DB::transaction(function () use ($request) {

    $password = $request->password;
    $tb = $this->userService->storeStudent($request);

    try {
        // Fire event to store Student information
        if(event(new StudentInfoUpdateRequested($request,$tb->id))){

            // Fire event to send welcome email
            event(new UserRegistered($tb, $password));
        } else {

            throw new \Exeception('Event returned false');
        }
    } catch(\Exception $ex) {

        Log::info('Email failed to send to this address: '.$tb->email.'\n'.$ex->getMessage());
    }
});

我正在使用PostgreSQL。帮我解决这个问题

0 个答案:

没有答案