Bladeren bron

modifiche

Roberto Santini 1 week geleden
bovenliggende
commit
17b1ec9bbf
1 gewijzigde bestanden met toevoegingen van 7 en 7 verwijderingen
  1. 7
    7
      app/Models/ContrattoServizio.php

+ 7
- 7
app/Models/ContrattoServizio.php Bestand weergeven

@@ -286,9 +286,9 @@ class ContrattoServizio extends \App\Models\AbstractModels\AbstractContrattoServ
286 286
             return $this->righe;
287 287
         }
288 288
 
289
-        $this->loadMissing('contrattoServizioRigas.prodotto');
289
+        $this->loadMissing('righe.prodotto');
290 290
 
291
-        return $this->contrattoServizioRigas;
291
+        return $this->righe;
292 292
     }
293 293
 
294 294
     public function getPeriodoLabelAttribute(): string
@@ -306,11 +306,11 @@ class ContrattoServizio extends \App\Models\AbstractModels\AbstractContrattoServ
306 306
         if (! $this->contratto_template_id) {
307 307
             return 0;
308 308
         }
309
-        if (! $force && $this->contrattoServizioTodos()->exists()) {
309
+        if (! $force && $this->todos()->exists()) {
310 310
             return 0;
311 311
         }
312 312
         if ($force) {
313
-            $this->contrattoServizioTodos()->delete();
313
+            $this->todos()->delete();
314 314
         }
315 315
 
316 316
         $template = ContrattoTemplate::with('contrattoTemplateTodos')->find($this->contratto_template_id);
@@ -357,11 +357,11 @@ class ContrattoServizio extends \App\Models\AbstractModels\AbstractContrattoServ
357 357
         if (! $this->contratto_template_id) {
358 358
             return 0;
359 359
         }
360
-        if (! $force && $this->contrattoServizioRigas()->exists()) {
360
+        if (! $force && $this->righe()->exists()) {
361 361
             return 0;
362 362
         }
363 363
         if ($force) {
364
-            $this->contrattoServizioRigas()->delete();
364
+            $this->righe()->delete();
365 365
         }
366 366
 
367 367
         $template = ContrattoTemplate::with('contrattoTemplateRigas.prodotto')->find($this->contratto_template_id);
@@ -370,7 +370,7 @@ class ContrattoServizio extends \App\Models\AbstractModels\AbstractContrattoServ
370 370
         }
371 371
 
372 372
         $count = 0;
373
-        foreach ($template->contrattoTemplateRigas as $riga) {
373
+        foreach ($template->righe as $riga) {
374 374
             ContrattoServizioRiga::create([
375 375
                 'contratto_servizio_id' => $this->id,
376 376
                 'prodotto_id' => $riga->prodotto_id,

Laden…
Annuleren
Opslaan