Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected $appends = [
- "c18", "c19", "c24", "c26", "c29", "c30", "c35", "c43", "c49",
- "c25", "c36", "c37", "c38", "c44", "c45", "c50", "c51",
- "step1", "step2", "step3", "step4", "step5", "step6", "step7",
- "progress",
- ];
- protected function progress(): Attribute
- {
- return Attribute::make(
- get: fn () => $this->criterias->groupBy('step_id')->map(function($item, $key) {
- $count = 0;
- for ($i=0; $i < count($item); $i++) {
- if ($item[$i]['pivot']['doc_path'] != null) {
- $count += 1;
- }
- }
- return ["Step$key" => number_format($count / $item->count(), 1)];
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement