Override Core Module - Error
-
Hi,
Your Category model should be like this -
<?php
namespace Itec\Category\Models;
use Webkul\Category\Models\Category as CategoryBaseModel;
class Category extends CategoryBaseModel
{}
Thanks
-
Hi,
In your service provider, boot method should be consist following one.
$this->app->concord->registerModel(
\Webkul\Category\Contracts\Category::class, \Itec\Category\Models\Category::class
);In registerModel method we use the contract of that model to whom we want to override & our model who gonna override it.
Thanks
-
Hey, when the upper portion goes well. Thanks.
I'm having another issue. Whenever I try to add or edit category it says
Class 'Itec\Category\Models\CategoryTranslation' not found
When I add CategoryTranslation and extend the Webkul CategoryTranslation then it says
Cannot declare class Webkul\Category\Models\CategoryTranslation, because the name is already in use
Models/CategoryTranslations.php
-
This post is deleted! -
Hi @rkreza, so the problem that has been pointed out by you has been resolved or not?
-
@rkreza said in Override Core Module - Error:
No
-
Hi,
You are using same name 'CategoryTranslation' which is already used in core package, so instated of creating this one, you can use core package's model otherwise you want to create it, then create with different name.
Thanks
-
@rahul said in Override Core Module - Error:
Hi,
You are using same name 'CategoryTranslation' which is already used in core package, so instated of creating this one, you can use core package's model otherwise you want to create it, then create with different name.If I create a different named model then it says CategoryTranslation not found.
-
Hi,
Can you attach a screenshot of error with your model.
Thanks
-
After putting your code
Models/Category.php
AppServiceProvider.php
-
@rkreza said in Override Core Module - Error:
If I create a different named model then it says CategoryTranslation not found.
Or how can I use Category's CategoryTranslation without creating it?
-
Hi @rkreza,
We have resolved your issues and created merge request at gitlab. Kindly see it.
Thanks
-
Thank you so much.
-
This post is deleted! -
I'm having trouble with extending Controller, Repository and DataGrid. What should I do?
-
Hi,
You can override our views & can provide them path of your controller (route & controller of your package).
To override views - Inside laravel's default views folder, (ressorces->vendor), create your views followed by same directory structure as our view consist.Thanks