laravel-woocommerce icon indicating copy to clipboard operation
laravel-woocommerce copied to clipboard

The model of this package causing issue in tinker (URGENT)

Open ayophanz opened this issue 4 years ago • 2 comments

Example I have model Product will return error when I try to run (my model) Product::find(1); in tinker, the issue I notice when I have model same name in package(this package) model.

suggestion make the model of this package unique ex. wooProduct wooOrder don't used common name.

error: Exception with message 'cURL Error: Could not resolve host: YOUR_WEBSITE_URL'

image

ayophanz avatar Feb 08 '21 08:02 ayophanz

Hello @ayophanz,

Thanks for your suggestion. Yes, you are right we should use a unique name when something writes in global space. Since we are using a unique custom namespace so we can use the same model name in a different namespace. If you have the same model name in your own namespace and you want both then use like this

use Product as WooProduct;

OR

use Codexshaper\WooCommerce\Models\Product as WooProduct;

Hope it will solve your issue.

maab16 avatar Feb 09 '21 05:02 maab16

I already do this works fine but this is not the issue the issue when you try to run in tinker. Pls try it on your self. Create a model the same name in the package model and run the tinker then call the model like this ex Product::find(1); and you will see the issue.

Thanks

On Tue, Feb 9, 2021, 1:09 PM Md. Abu Ahsan Basir [email protected] wrote:

Hello @ayophanz https://github.com/ayophanz,

Thanks for your suggestion. Yes, you are right we should use a unique name when something writes in global space. Since we are using a unique custom namespace so we can use the same model name in a different namespace. If you have the same model name in your own namespace and you want both then use like this

use Product as WooProduct;

OR

use Codexshaper\WooCommerce\Models\Product as WooProduct;

Hope it will solve your issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Codexshaper/laravel-woocommerce/issues/63#issuecomment-775667628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3RLUFWZV2XDF5CBROYDZDS6C7R7ANCNFSM4XIQPQ3Q .

ayophanz avatar Feb 09 '21 06:02 ayophanz