Skip to content

Commit

Permalink
Added LabelsAssigned::create into try catch
Browse files Browse the repository at this point in the history
Added LabelsAssigned::create into try catch
  • Loading branch information
cp6 committed Sep 25, 2023
1 parent f4bd6e6 commit ebf4e52
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/Models/Labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Mockery\Exception;

class Labels extends Model
{
Expand Down Expand Up @@ -32,10 +33,14 @@ public static function insertLabelsAssigned(array $labels_array, string $service
{
for ($i = 1; $i <= 4; $i++) {
if (!is_null($labels_array[($i - 1)])) {
LabelsAssigned::create([
'label_id' => $labels_array[($i - 1)],
'service_id' => $service_id
]);
try {
LabelsAssigned::create([
'label_id' => $labels_array[($i - 1)],
'service_id' => $service_id
]);
} catch (Exception $exception) {

}
}
}
}
Expand Down

0 comments on commit ebf4e52

Please sign in to comment.