cas de non association de tag
This commit is contained in:
parent
2fbca40f06
commit
4e84e7e943
1 changed files with 12 additions and 10 deletions
|
|
@ -255,18 +255,20 @@ class ProductsController extends Controller
|
|||
}
|
||||
|
||||
//tags associés
|
||||
$arTagIds = array();
|
||||
foreach($tags as $tag) {
|
||||
$oTag = json_decode($tag);
|
||||
if(empty($oTag->id)) {
|
||||
//we need a new tag
|
||||
$arTagIds[] = $this->storeTag($oTag);
|
||||
} else {
|
||||
$arTagIds[] = $oTag->id;
|
||||
if(count($tags)) {
|
||||
$arTagIds = array();
|
||||
foreach($tags as $tag) {
|
||||
$oTag = json_decode($tag);
|
||||
if(empty($oTag->id)) {
|
||||
//we need a new tag
|
||||
$arTagIds[] = $this->storeTag($oTag);
|
||||
} else {
|
||||
$arTagIds[] = $oTag->id;
|
||||
}
|
||||
}
|
||||
//prise en charge de la liaison avec les produits
|
||||
$product->tags()->sync($arTagIds);
|
||||
}
|
||||
//prise en charge de la liaison avec les produits
|
||||
$product->tags()->sync($arTagIds);
|
||||
|
||||
//produits associés
|
||||
if(!empty($request->prods)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue