Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic SKU generation issue #78

Open
samuelabate opened this issue Dec 14, 2018 · 0 comments
Open

Automatic SKU generation issue #78

samuelabate opened this issue Dec 14, 2018 · 0 comments

Comments

@samuelabate
Copy link

samuelabate commented Dec 14, 2018

Hello there,

I was using this great library but I encountered an issue. I am on Laravel 5.7 and even though I have created the inventory with category_id and metric_id provided, the sku is not generated. The functions $inventory->generateSku(), $inventory->regenerateSku() and $inventory->hasSku() all return an empty string even though $inventory->createSKU("skuCode"); works fine. If you need to know, Here is the code i've used:

        try {

            $inventory = new Inventory();

            $inventory->name = $request->inventoryName;
            $inventory->category_id = $request->categoryId;
            $inventory->metric_id = $request->metricId;
            $inventory->description = $request->inventoryDescription;

            $inventory->save();

            $inventory->category;
            $inventory->metric;
            $inventory->sku;

            $response['success'] = true;
            $response['inventory'] = $inventory;
            $response['message'] = "Inventory Created Successfully.";
        } catch (\Exception $e) {
            $response['success'] = false;
            $response['message'] = $e->getMessage();
        }

Can you please suggest what I should do to resolve the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant