Added LabelsAssigned::create into try catch
Added LabelsAssigned::create into try catch
This commit is contained in:
parent
f4bd6e6d66
commit
ebf4e5243c
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user