first(); if (!$user) { $user = User::create([ 'hashkey' => Str::random(64), 'name' => 'Rex Loba', 'fullname' => 'Rex Moran Loba', 'email' => 'rexm.loba@gmail.com', 'mobile_number' => '09123456789', 'username' => 'rexl', 'password' => 'password', // Hash should be handled by model or manually if not 'acct_type' => 'user', 'active' => true, ]); } $userInfo = UserInfo::where('user_id', $user->id)->first(); if (!$userInfo) { $userInfo = new UserInfo([ 'user_id' => $user->id, 'hashkey' => Str::random(64), ]); } $userInfo->fill([ 'firstname' => 'Rex Moran', 'lastname' => 'Loba', 'fullname' => 'Rex Moran Loba', 'email' => 'rexm.loba@gmail.com', 'mobile' => '09123456789', 'civil_status' => 'Single', 'education_level' => 'Bachelor\'s Degree', 'livelihood_source' => 'Software Development', 'is_active' => true, ]); $userInfo->save(); } }