1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 15:33:44 +01:00

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\Model;
use Illuminate\Support\Facades\Cache;
use Mockery\Exception;
class Labels extends Model
{
@ -32,10 +33,14 @@ class Labels extends Model
{
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) {
}
}
}
}