Store data through Repository - Not working
I'm having trouble with this error -
*Illuminate \ Contracts \ Container \BindingResolutionException Target [Webkul\Brand\Contracts\Brand] is not instantiable while building [Webkul\Brand\Http\Controllers\BrandController].*
I was trying to create new package. Using direct model & controller is fine and working but when I was trying repositories,contracts & proxies I get this error.
[N.B : I implement the Brand (Contracts) in my Brand (Model)]
Please make sure that you have created 'ModuleServiceProvider.php' file in your package & mentioned all of your model here. Like -
class ModuleServiceProvider extends BaseModuleServiceProvider
protected $models = [
after doing it, in config folder you can see there is a 'concord.php' file, mention this provider there like -
'modules' => [
for more reference, please see any of our package.
Do I have to create "concord.php" in my newly created package?
If so, then I already created "concord.php" and added modules but error still there. I was trying to use your Category module as reference.
No, you don't need to create it, it will be in config folder, see there and do whatever i mentioned above.
Still getting error...
And the other problem is Whenever I run these commands
php artisan config:clear php artisan cache:clear php artisan route:cache php artisan view:clear composer dump-autoload php artisan vendor:publish
This error occurs
Then command solves the error
php artisan config:cache
run 'php artisan migrate' to solve above error.
It says Nothing to migrate.
Make sure that you have implemented or extended contract on your model like -
use Webkul\Attribute\Contracts\Attribute as AttributeContract;
class Attribute extends TranslatableModel implements AttributeContract
In the above example, you can see that Attribute model is implementing its contract AttributeContract and i think you are missing this.
after this please run -
php artisan config:clear
php artisan cache:clear
php artisan key:generate