Skip to content

Commit

Permalink
fix missing category id
Browse files Browse the repository at this point in the history
  • Loading branch information
caothu159 committed Aug 13, 2024
1 parent 53ccd0d commit c68ce72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions diepxuan/laravel-catalog/src/Models/Casts/CategoryMagento.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Tran Ngoc Duc <ductn@diepxuan.com>
* @author Tran Ngoc Duc <caothu91@gmail.com>
*
* @lastupdate 2024-06-14 22:49:46
* @lastupdate 2024-08-13 11:08:07
*/

namespace Diepxuan\Catalog\Models\Casts;
Expand All @@ -25,7 +25,9 @@ class CategoryMagento
public function get(Category $model, string $key, mixed $value, array $attributes)
{
$value = new \stdClass();
$magento_id = array_replace([-1, -1], explode(',', $attributes['magento_id']));
$magento_id = $attributes['magento_id'] ?? '';
$magento_id = explode(',', $magento_id);
$magento_id = array_replace([-1, -1], $magento_id);

$value->default = $magento_id[0];
$value->everon = $magento_id[1];
Expand Down

0 comments on commit c68ce72

Please sign in to comment.