问题描述
我注意到我在 PHPStorm 中的某些文件没有检测到任何更改,而在其他文件中,如果我进行了一些代码更改,我可以立即看到更改。
有没有办法在 PHPStorm 设置中找到自动检测所有已编辑文件的位置?
我已经检查了我的 .gitignore
文件,但我看不到无法跟踪的文件。
例如,在我的 UserScopeTrait.PHP
文件中,我进行了代码更改,并且在 git status 时自动看到了更改。但在我的 UserTrait.PHP
文件中,如果我对其进行了更改,则找不到任何更改。
以下是我进行了一些更改的确切文件:
这是 UserScopeTrait.PHP
文件,可以自动检测到文件更改:
<?PHP
namespace App\Traits;
use App\Jobs\SendEmployeeInvitationEmail;
use App\Jobs\SendEmployeeInvitationMondayTuesdayJob;
use App\Jobs\UpdateAdminemployeeSurvey;
use App\Language;
use App\Location;
use App\LocationManager;
use App\Mail\SendWeeklySurvey;
use App\Mail\SurveyResultsAvailableNotification;
use App\Mail\SurveySentNotification;
use App\Repositories\UserCompanyRepository;
use App\Survey;
use App\Team;
use App\TeamManager;
use App\User;
use App\UserCompany;
use App\UsersAnswer;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Mail;
trait UserScopeTrait
{
public function scopedispatchEmployeeInvites($query)
{
$users = $query->whereHas('userCompany',function ($company) {
$company->where('company_id',auth()->user()->company->id)->where('role_name','employee');
})->where('invite_sent',0)->get();
$auth = auth()->user();
$dispatcher = new User();
$toSend = 0;
$notifyState = [];
// this is the changes I've made
adsfdsfasdfas
if ($users->count() == 5) {
/**
* first survey batch send
* date of action: all days except Monday,Tuesday
* send invitation & update survey details for admin and then mimic admin survey details to employee
*/
if (!Carbon::Now()->isMonday() && !Carbon::Now()->isTuesday()) {
$this->updateSurveyDetailsAdminemployee(null,$auth,'admin');
}
}
foreach ($users as $employee) {
$notifyState['total'] = $users->count();
$employee->invite_sent = true;
$employee->save();
$toSend++;
if ($notifyState['total'] == $toSend) {
$notifyState['last'] = true;
// Admin receive an email notification about surveys sent
$dispatcher->dispatchAdminSurveySentNotification($auth);
} else {
$notifyState['last'] = false;
}
/**
* counter reaches to 5 this means that this is the first survey
* and should update survey details for both admin & employee
*/
if ($users->count() == 5) {
if (Carbon::Now()->isMonday()||Carbon::Now()->isTuesday()) {
/**
* first survey batch send
* date of action: Monday,Tuesday
* send invitation only
*/
SendEmployeeInvitationMondayTuesdayJob::dispatch($employee,auth()->user())->onQueue('notification');
} else {
/**
* first survey batch send
* date of action: all days except Monday,Tuesday
* send invitation & mimic admin survey details to employee
*/
$this->updateSurveyDetailsAdminemployee($employee,'employee');
SendEmployeeInvitationEmail::dispatch($auth,$employee,$notifyState)->onQueue('notification');
}
}
/**
* not first survey batch & single execution
*/
else {
if ($users->count() >=2 && $users->count() <= 3) {
/**
* not first survey batch execution
* date of action: Monday,Tuesday
* send invitation only
*/
if (Carbon::Now()->isMonday()||Carbon::Now()->isTuesday()) {
SendEmployeeInvitationMondayTuesdayJob::dispatch($employee,auth()->user())->onQueue('notification');
}
/**
* not first survey batch execution
* date of action: all days except Monday,Tuesday
* send invitation & update survey details for employee only mimic admin survey details
*/
else {
$this->updateSurveyDetailsAdminemployee($employee,'employee');
SendEmployeeInvitationEmail::dispatch($auth,$notifyState)->onQueue('notification');
}
}
if ($users->count() == 1) {
/**
* not first survey single execution
* date of action: Monday,auth()->user())->onQueue('notification');
}
/**
* not first survey single execution
* date of action: all days except Monday,Tuesday
* send invitation & update survey details for employee mimic admin survey details
*/
else {
$this->updateSurveyDetailsAdminemployee($employee,$notifyState)->onQueue('notification');
}
}
}
}
}
private function updateSurveyDetailsAdminemployee($employee,$type)
{
$currentDate = Carbon::Now();
$nextSurveyDate = clone $currentDate;
if ($type == 'admin') {
date_default_timezone_set($auth->timezone);
// Set next_survey_date base on account owner survey frequency setting
if ($auth->account->survey_frequency == 'every_week_wednesday') {
$nextSurveyDate = $nextSurveyDate->next(Carbon::WednESDAY);
} else {
$nextSurveyDate = $nextSurveyDate->next(Carbon::WednESDAY)->next(Carbon::WednESDAY);
}
// Update survey_date and next_survey_number for admin
$auth->current_survey_date = $currentDate;
$auth->next_survey_date = $nextSurveyDate;
$auth->first_survey = true;
$auth->next_survey_number = (new User())->getNextSurveyNumber($auth);
$auth->save();
}
else if ($type == 'employee') {
date_default_timezone_set($employee->timezone);
// Update next_survey_date and next_survey_number for employee
$employee->next_survey_date = $auth->next_survey_date;
$employee->current_survey_id = $auth->current_survey_id;
$employee->current_survey_date = $currentDate;
$employee->next_survey_number = $auth->next_survey_number;
$employee->invite_sent_time = Now()->toDateTimeString();
$employee->save();
}
}
public function scopeUpdateMessageNotificationCounter($query,$data)
{
$managers = $query->whereHas('userCompany',function ($userCompany) use ($data) {
$userCompany->where('company_id',(new User())->authUserCompanyId())->where('role_name','manager');
})->get();
foreach ($managers as $user) {
$user->wait_for_my_reply = $data['waitingForMyReply'];
$user->wait_for_employee_organization_reply = $data['waitingForEmployeeOrganizationReply'];
$user->save();
}
$admin = User::whereHas('company',function ($company) {
$company->where('id',(new User())->authUserCompanyId());
})->first();
$admin->wait_for_my_reply = $data['waitingForMyReply'];
$admin->wait_for_employee_organization_reply = $data['waitingForEmployeeOrganizationReply'];
$admin->save();
}
public function scopeUserHasSurvey($query,$id)
{
$currentSurveyDate = $query->find($id)->current_survey_date;
$nextSurveyDate = $query->find($id)->next_survey_date;
if ($currentSurveyDate != null && $nextSurveyDate != null) {
return true;
} else {
return false;
}
}
public function scopeUserCompanyId($query,$id)
{
return $query->find($id)->company->id;
}
public function scopeUserCurrentSurveyId($query,$id)
{
return $query->find($id)->current_survey_id;
}
public function scopeFilteradminAccess()
{
if (auth()->user()->freeze_account > 0 && auth()->user()->role_name == 'admin') {
return redirect()->route('billing')->with(['info' => 'Your account is freeze']);
}
}
public function scopeActiveAdmin($query)
{
$query = $query->role('admin')->where('freeze_account',0);
$query = $query->whereNotNull('email_verified_at')->where('active',1)->get();
return $query;
}
public function scopeTrialGracePeriodActiveAdmin($query)
{
return $query->role('admin')
->where('freeze_account',0)
->whereNotNull('email_verified_at')
->where('active',1)
->where('trial_grace_period',true);
}
public function scopeActiveEmployee($query,$companyId)
{
$query = $query->whereHas('roles',function ($roles) {
$roles->where('name','employee');
});
$query = $query->whereNotNull('email_verified_at')->where('active',1);
$query = $query->whereHas('userCompany',function ($userCompany) use ($companyId) {
$userCompany->where('company_id',$companyId);
})->get();
return $query->count();
}
public function scopeAdminReplies($query)
{
$query = $query->whereHas('company',(new User())->authUserCompanyId());
})->first();
return $query->total_replies;
}
public function scopeIncrementReplies($query,$message)
{
$query = $query->whereHas('company',(new User())->authUserCompanyId());
})->first();
if (!is_null($message)) {
$query->increment('total_replies');
}
}
public function scopeSendSurveyResultNotification($query)
{
$user = new User();
$admin = $query->whereHas('company',(new User())->authUserCompanyId());
})->first();
// process survey result for admin
$user->processSurveyResult($admin);
$managers = User::whereHas('userCompany',function ($userCompany) use ($admin) {
$userCompany->where('company_id',$admin->company->id)->where('role_name','manager');
})->get();
if ($managers->count() > 0) {
foreach ($managers as $manager) {
// process survey result for manager
$user->processSurveyResultManager($manager);
}
}
}
public function scopeIncrementUserColumn($query,$column)
{
$query = $query->whereHas('company',(new User())->authUserCompanyId());
})->first();
switch ($column) {
case 'surveys_completed':
$query->increment('surveys_completed');
break;
case 'email_notification_sent':
$query->increment('email_notification_sent');
break;
case 'cheers_sent':
$query->increment('cheers_sent');
break;
case 'resolved_issues':
$query->increment('resolved_issues');
break;
case 'total_answers':
$query->increment('total_answers');
break;
case 'uncompleted_replies':
$query->increment('uncompleted_replies');
break;
case 'add_more':
$query->increment('add_more');
break;
}
}
public function scopeDecrementUserColumn($query,(new User())->authUserCompanyId());
})->first();
switch ($column) {
case 'uncompleted_replies':
$query->decrement('uncompleted_replies');
break;
}
if ($query->uncompleted_replies < 1) {
$query->add_more = 0;
$query->save();
}
}
public function scopeDecrementResolvedissues($query)
{
$query = $query->whereHas('company',(new User())->authUserCompanyId());
})->first();
$query->decrement('resolved_issues');
}
public function scopeGetUserEmployeeId($query)
{
$query = $query->whereHas('roles',function ($q) {
$q->where('name','employee');
})->get();
$query = $query->pluck('id');
return $query;
}
public function sendSurvey($query)
{
$users = User::get();
foreach ($users as $user) {
if ($user->employees >= 5) {
// Get all employees where company is equal to $this->user
$userId = UserCompany::where('company_id',$user->company->id)->pluck('user_id');
}
}
}
public function scopeGetCompanyId($query,$userId)
{
$query = $query->find($userId)->userCompany->company_id;
return $query;
}
public function scopeGetSurveyCompleted($query)
{
$users = User::whereHas('roles',function ($role) {
$role->where('name','admin');
});
}
public function scopeGetCurrentSurveyDetails($query,$request = null)
{
$companyId = null;
$userAnswerFilter = new UsersAnswer();
if (!is_null($request)) {
// this is checking request parameters from super admin's vibe monitor
if (isset($request['id'])) {
$user = $query->find($request['id']);
} else {
$user = $query->find(auth()->id());
}
} else {
$user = $query->find(auth()->id());
}
if ($user->role_name == 'admin') {
$companyId = $user->company->id;
} elseif ($user->role_name == 'manager') {
$companyId = $user->userCompany->company_id;
}
$employeeCount = UserCompany::where('company_id',$companyId)
->where('role_name','employee')
->where('last_login_at','!=',null);
$surveyCompleted = UserCompany::where('company_id','employee')
->where('survey_completed',true);
$userAnswerFilter->filter($request,$surveyCompleted);
$userAnswerFilter->filter($request,$employeeCount);
$surveyCompleted = $surveyCompleted->count();
$employeeCount = $employeeCount->count();
if ($surveyCompleted > 0) {
$completionPercentage = round(($surveyCompleted / $employeeCount) * 100);
} else {
$completionPercentage = 0;
}
// date_default_timezone_set($user->timezone);
$Now = Carbon::Now();
$start = Carbon::parse($user->current_survey_date);
$end = Carbon::parse($user->current_survey_date)->next(Carbon::TUESDAY)->endOfDay();
// $end = $user->next_survey_date;
// $surveyStarts = Carbon::parse($start);
$surveyStarts = Carbon::parse($start)->format('Y-m-d');
// $surveyEnds = Carbon::parse($end);
$surveyEnds = Carbon::parse($end)->format('Y-m-d');
$Now = Carbon::parse($Now);
// $start = Carbon::parse($start);
// $end = Carbon::parse($end);
$diff = $end->diffInDays($Now);
$status = $diff > 1 ? ('(' . $diff . ' days left)') : ('(' . $diff . ' day left)');
// $start = Carbon::parse($start)->isoFormat('LL');
// $end = Carbon::parse($end)->isoFormat('LL');
return [
'surveyId' => $user->current_survey_id,'employeeCount' => $employeeCount,'surveyCompleted' => $surveyCompleted,'completionPercentage' => $completionPercentage,'status' => $status,'difference' => $diff,'start' => $start->isoFormat('LL'),'end' => $end->isoFormat('LL'),'surveyStarts' => $surveyStarts,'surveyEnds' => $surveyEnds
];
}
public function scopeGetUpcomingSurveyDetails($query,$userId = null)
{
$uId = $userId ?? auth()->id();
$auth = $query->find($uId);
// $surveyStarts = Carbon::createFromFormat('m-d-Y',$auth->next_survey_date);
$surveyStarts = Carbon::parse($auth->next_survey_date);
// Set survey ends base on account owner survey frequency setting
if ($auth->account->survey_frequency == 'every_week_wednesday') {
// $surveyEnds = $surveyStarts->addDays(7)->format('m-d-Y');
$surveyEnds = $surveyStarts->next(Carbon::TUESDAY)->endOfDay();
} else {
// $surveyEnds = $surveyStarts->addDays(14)->format('m-d-Y');
$surveyEnds = $surveyStarts->next(Carbon::TUESDAY)->next(Carbon::TUESDAY)->endOfDay();
}
// $Now = Carbon::Now()->format('m-d-Y');
$start = $auth->next_survey_date;
$end = $surveyEnds;
$Now = Carbon::Now();
$start = Carbon::parse($auth->next_survey_date);
$end = Carbon::parse($end);
$dateStartDbFormat = $auth->next_survey_date;
$dateEndDbFormat = $end;
$diff = $end->diffInDays($Now);
$status = $diff > 1 ? ('(' . $diff . ' days left)') : ('(' . $diff . ' day left)');
$start = Carbon::parse($start)->isoFormat('LL');
$end = Carbon::parse($end)->isoFormat('LL');
return [
'surveyId' => $userId != null ? 'this is for email notification' : (new User())->authUserNextSurveyId(),'start' => $start,'dateStartDbFormat' => $dateStartDbFormat,'dateEndDbFormat' => $dateEndDbFormat,'end' => $end
];
}
public function scopeGetUpcomingSurveyDetails2($query)
{
$auth = $query->find(auth()->id());
$surveyStarts = Carbon::createFromFormat('m-d-Y',$auth->next_survey_date);
// Set survey ends base on account owner survey frequency setting
if ($auth->account->survey_frequency == 'every_week_wednesday') {
$surveyEnds = $surveyStarts->addDays(7)->format('m-d-Y');
} else {
$surveyEnds = $surveyStarts->addDays(14)->format('m-d-Y');
}
$Now = Carbon::Now()->format('m-d-Y');
$start = $auth->next_survey_date;
$end = $surveyEnds;
$Now = Carbon::createFromFormat('m-d-Y',$Now);
$start = Carbon::createFromFormat('m-d-Y',$start);
$end = Carbon::createFromFormat('m-d-Y',$end);
$dateStartDbFormat = $auth->next_survey_date;
$dateEndDbFormat = $end->format('m-d-Y');
$diff = $end->diffInDays($Now);
$status = $diff > 1 ? ('(' . $diff . ' days left)') : ('(' . $diff . ' day left)');
$start = Carbon::parse($start,'Asia/Manila')->isoFormat('LL');
$end = Carbon::parse($end,'Asia/Manila')->isoFormat('LL');
return [
'surveyId' => (new User())->authUserNextSurveyId(),'end' => $end
];
}
public function scopeGetPastSurveys($query)
{
$auth = $query->find(auth()->id());
$currentSurveyDate = Carbon::createFromFormat('m-d-Y',$auth->current_survey_date);
}
public function scopeAccountNotificationsSchedule($query,$schedule)
{
$users = $query->where('email_verified_at',null)->where('active',1)->get();
foreach ($users as $user) {
$notification = $user->account->notifications['new_message'] ?? null;
if ($notification) {
$frequency = null;
switch ($notification) {
case 'every_10_minutes':
$frequency = 'everyTenMinutes';
break;
case '1x_per_hour':
$frequency = 'hourly';
break;
case '1x_per_day':
$frequency = 'daily';
break;
default:
break;
}
if ($user->total_replies != $user->new_messages_notification) {
$schedule->call(function () use ($user,$frequency) {
$language = $user->language;
$newMessages = $user->new_messages_notification;
$totalReply = $user->total_replies;
if ($newMessages > 1) {
$newMessages = $totalReply - $newMessages;
} else {
$newMessages = $user->total_replies;
}
if ($user->account->language_setting) {
$language = Language::find($user->account->language_setting)->language;
}
/** this should have job to avoid rapid sending of email that spikes email service provider */
Mail::to($user)->locale($language)->send(new \App\Mail\SendNewMessagesNotification($user,$newMessages));
$user->new_messages_notification = $user->total_replies;
$user->save();
})->$frequency();
}
}
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)