ProjektObjekteImDetailRelationManager calc nutzwerte all at once
This commit is contained in:
1 parent
245136c3af
commit
aa7d95ac5f
1 file changed
+16
-3
+16
-3
@@ -142,9 +142,22 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
// Action::make('nutzwerte')
|
||||
// ->label('Nutzwerte')
|
||||
// ->icon('phosphor-gear'),
|
||||
Action::make('nutzwerte')
|
||||
->label('Nutzwerte')
|
||||
->icon('phosphor-gear')
|
||||
->action(function () {
|
||||
$res = ProjektObjekteImDetail::with('methode')
|
||||
->where('projekte_id', $this->getOwnerRecord()->id)
|
||||
->get();
|
||||
|
||||
foreach ($res as $row) {
|
||||
ProjektObjekteImDetail::where('id', $row->id)
|
||||
->update(['nutzwert' => $row->flaeche * $row->methode->faktor]);
|
||||
}
|
||||
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshProjektObjekteImDetail');
|
||||
}),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()
|
||||
|
||||
Reference in new issue
Block a user