如何解决注册功能中的错误“无效视图”?

时间:2019-10-18 16:08:02

标签: reactjs laravel laravel-5 eloquent

在为我正在工作的应用程序的招聘人员注册过程中出现错误

这是发送表单信息时我在网络中遇到的错误:

代码:500 错误:“无效的视图”。 消息:“竞赛结束时的爱人”

这是代码

  public function personnal(AccountCreateRequest $request)
{
    try {
        $http = new \GuzzleHttp\Client;
        $exists = false;
        $userData = $request->input('user');
        $userData['password'] = bcrypt($userData['password']);
        $userData['gender'] = ($userData['title'] === 'M.') ? 'm' : 'f';
        if (array_get($userData, 'ref')) {
            $user = User::where('ref', $userData['ref'])->firstOrFail();
            $user->fill($userData);
            $exists = true;
        } else {
            $userData['ref'] = User::generateId();
            $user = new User($userData);
        }
        $user->source = 'website';
        $user->optin_platform = 1;

        if ($user->role === 'seeker') {
            $user->is_active = 1;
            $user->save();
            $seeker = new UserSeeker([
                'registration_date' => Carbon::now(),
                'available_in'      => 1,
                'token'             => bin2hex(uniqid(rand())),
                'resume_path'       => $request->input('seeker.resume_path'),
                'resume_date'       => Carbon::now(),
            ]);
            $seeker = $user->seeker()->save($seeker);
            $seeker->location()->associate(Address::create($request->input('location')))->save();
        } else {
            $user->is_active = 0;
            $user->save();
            // $size = $request->input('company.size', $request->session()->get('info'));
            $companyData = $request->input('company');
            $company = Company::create($companyData);
            $recruiter = $user->recruiter()->save(new UserRecruiter([
                'company_id' => $company->id,
            ]));
        }
        DB::commit();
        $this->json['response'] = ['ref' => $user->ref];
        $this->json['code'] = $this->code['created'];
        dd($this->json);
    } catch (MissingParamsException $e) {
        DB::rollback();
        $this->setError($e, $e->getMessage(), 'missing');
    } catch (\Exception $e) {
        DB::rollback();
        $this->setError($e, 'Erreur lors de la création du compte');
    } finally {
        return ($this->response());
    }

1 个答案:

答案 0 :(得分:0)

我通过将is_active参数更改为1解决了我的问题