Browse Source

update header if start / end date changed / an activity deleted

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
69ea8e83e3
  1. 4
      app/Models/Activity.php

4
app/Models/Activity.php

@ -166,8 +166,8 @@ class Activity extends Model
private function updateStartEndDateHeader()
{
$earliestStartDate = Activity::where('version_gantt_id', $this->version_gantt_id)->oldest('start_date')->pluck('start_date')->first();
$latestEndDate = Activity::where('version_gantt_id', $this->version_gantt_id)->latest('end_date')->pluck('end_date')->first();
$earliestStartDate = Activity::where('version_gantt_id', $this->version_gantt_id)->whereNotNull('parent_id')->oldest('start_date')->pluck('start_date')->first();
$latestEndDate = Activity::where('version_gantt_id', $this->version_gantt_id)->whereNotNull('parent_id')->latest('end_date')->pluck('end_date')->first();
if($header = Activity::where('version_gantt_id', $this->version_gantt_id)->whereNull('parent_id')->first()) {
$header->update([
"start_date" => $earliestStartDate,

Loading…
Cancel
Save