Added LabelsAssigned::create into try catch

Added LabelsAssigned::create into try catch
This commit is contained in:
cp6 2023-09-25 23:40:13 +10:00
parent f4bd6e6d66
commit ebf4e5243c

View File

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Mockery\Exception;
class Labels extends Model class Labels extends Model
{ {
@ -32,10 +33,14 @@ class Labels extends Model
{ {
for ($i = 1; $i <= 4; $i++) { for ($i = 1; $i <= 4; $i++) {
if (!is_null($labels_array[($i - 1)])) { if (!is_null($labels_array[($i - 1)])) {
LabelsAssigned::create([ try {
'label_id' => $labels_array[($i - 1)], LabelsAssigned::create([
'service_id' => $service_id 'label_id' => $labels_array[($i - 1)],
]); 'service_id' => $service_id
]);
} catch (Exception $exception) {
}
} }
} }
} }