Browse Source

Merge pull request 'update upload 2023-10-16' (#209) from staging into master

Reviewed-on: ordo/adw-backend#209
pull/3/head
farhantock 1 year ago
parent
commit
0c21400397
  1. 9
      app/Http/Controllers/ActivityController.php
  2. 34
      app/Models/Role.php

9
app/Http/Controllers/ActivityController.php

@ -175,6 +175,7 @@ class ActivityController extends Controller
}else{
$data = Activity::select('id', 'parent_id', 'name', 'actual_end')->where('parent_id', $id)->get();
}
$parent = Activity::findOrFail($id);
$dataFinal=[];
foreach ($data as $val) {
$activity = $this->getchildActivityForActual($val->id, $params);
@ -187,11 +188,19 @@ class ActivityController extends Controller
return isset($item['actual_start']);
}), 'actual_start');
$returnActualStartOrEnd = count($actualStartValues) == count($dataFinal) ? min($actualStartValues) : null;
if (isset($parent)) {
$parent->actual_start = $returnActualStartOrEnd;
$parent->save();
}
}else{
$actualEndValues = array_column(array_filter($dataFinal, function($item) {
return isset($item['actual_end']);
}), 'actual_end');
$returnActualStartOrEnd = count($actualEndValues) == count($dataFinal) ? max($actualEndValues) : null;
if (isset($parent)) {
$parent->actual_end = $returnActualStartOrEnd;
$parent->save();
}
}
// return json_encode(["min"=>$minActualStart, "max"=>$maxActualStart]);

34
app/Models/Role.php

@ -1,17 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
protected $table = 'm_roles';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
protected $table = 'm_roles';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
];
}

Loading…
Cancel
Save