Voyager: Voyager 1.4 bread problem. Target class does not exist.

Created on 6 Apr 2020  路  6Comments  路  Source: the-control-group/voyager

Version information

  • Laravel: v7.0
  • Voyager: v1.4
  • PHP: v7.4
  • Database: local sqlite

Description

Im faceing problem when i click Tools -> bread -> {any table} -> add BREAD to this table -> { im createing bread } -> submit -> see error.
BindingResolutionException
Target class [App\UserRole] does not exist.
It pops up to any table.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Go to Tools
  2. Go to bread
  3. Click add BREAD ... to any table
  4. Create bread
  5. Click submit
  6. See error

Screenshot

image

Additional context

Only things i have done, are create laravel project, and add voyager to it. When i try to add bread, it does not work. Rest of voyager functionalities like menu builder work.

Most helpful comment

@mikolajborowski
@kamel7dz
If you are using a newer version of Laravel:
When making BREAD, use App \ Models \ Your_Model - instead of App \ Your_Model

All 6 comments

The BREAD builder does not create models.
Only the database tool creates one if you create a new table and select "Create model".

So you just have to create the model, either by running php artisan make:model YourModel or by using the database tool.

I believe you should reopen this. I followed the same steps as @mikolajborowski said, and even selected "Create model" while making the table.
Afterwards I tried to make bread, and it failed because of a missing model.
It only worked after I manually run php artisan make:model MyModel

Illuminate\Contracts\Container\BindingResolutionException
Target class [App\Product] does not exist.
probleme in laravel 8

@mikolajborowski
@kamel7dz
If you are using a newer version of Laravel:
When making BREAD, use App \ Models \ Your_Model - instead of App \ Your_Model

Hello,
This happened to me when I changed a table name (from host/admin/database/{table}).
When changing a table name don't forget to change the model file name and the model class name.
Hope this helps!

@mikolajborowski
@kamel7dz
If you are using a newer version of Laravel:
When making BREAD, use App \ Models \ Your_Model - instead of App \ Your_Model

This is the solution. I faced with the same problem due to my carelessness. This fixed it. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

duongsieu picture duongsieu  路  3Comments

raoasifraza1 picture raoasifraza1  路  3Comments

abacram picture abacram  路  3Comments

Nagendra1421 picture Nagendra1421  路  3Comments

zzpwestlife picture zzpwestlife  路  3Comments