44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Actions\Generate\Nutzwerte;
|
|
|
|
use App\Models\Orientierung;
|
|
use App\Models\Raumalles;
|
|
use App\Models\Raumorientierung;
|
|
|
|
class Zusammenstellung_Methode1
|
|
{
|
|
public static function load($projekts_id)
|
|
{
|
|
$res = Raumalles::select('raumorientierung_id', 'geschoss')->where('projekts_id', $projekts_id)->where('methodes_id', '1')->groupBy('raumorientierung_id', 'geschoss')->get();
|
|
$geschoss = [];
|
|
$raumorientierung_ids = [];
|
|
foreach ($res as $value) {
|
|
$geschoss[$value->raumorientierung_id][] = $value->geschoss;
|
|
$raumorientierung_ids[] = $value->raumorientierung_id;
|
|
}
|
|
|
|
$orientierung = Orientierung::map();
|
|
$orientierung[1] = '';
|
|
|
|
$res = Raumorientierung::where('projekts_id', $projekts_id)->whereIn('id', $raumorientierung_ids)->orderBy('top_nr')->get();
|
|
|
|
$return = [];
|
|
foreach ($res as $value) {
|
|
$tmp = [];
|
|
$tmp['id'] = $value->id;
|
|
$tmp['top_nr'] = $value->top_nr;
|
|
$tmp['type'] = $value->type;
|
|
$tmp['nutzwert_summe'] = $value->nutzwert_summe;
|
|
$tmp['orientierung'] = $orientierung[$value->orientierungs_id];
|
|
$tmp['geschoss'] = '';
|
|
if (isset($geschoss[$value['id']])) {
|
|
$tmp['geschoss'] = implode(',', $geschoss[$value->id]);
|
|
}
|
|
$return[] = $tmp;
|
|
}
|
|
|
|
return $return;
|
|
}
|
|
}
|