Laravel-Backpack / Generators

Generate files for Backpack projects
http://backpackforlaravel.com
MIT License
315 stars 64 forks source link

[bug] generating nested controllers and models #169

Closed AlexKomMsk closed 1 year ago

AlexKomMsk commented 1 year ago

If I write in small letters:

php artisan backpack:crud post/badge

Creates classes with small letters (badgeCrudController).

If I write in capital letters:

php artisan backpack:crud Post/Badge

Cannot add CrudTrait to model. And an error occurs:

Illuminate\Contracts\Container\BindingResolutionException
Target class [App\Http\Controllers\Admin\Post/BadgeCrudController] does not exist.

Because of the slash in the 'Post/BadgeCrudController' routes.

Also, does not find the model in the controller due to the wrong namespace.

CRUD::setModel(\App\Models\Badge::class);

Although the model is located here \App\Models\Post\Badge::class

Now I checked it - it does not display entries for models in folders, it gives a 404 error.

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 8.1.10 (cli) (built: Aug 30 2022 18:05:49) (ZTS Visual C++ 2019 x64) Copyright (c) The PHP Group Zend Engine v4.1.10, Copyright (c) Zend Technologies

LARAVEL VERSION:

v8.83.25@b77b908a9426efa41d6286a2ef4c3adbf5398ca1

BACKPACK VERSION:

5.4.7@6e1bb116de9f3091530cb9b11edcceb4d252daa8

pxpm commented 1 year ago

Thanks for the report @AlexKomMsk

I've moved this to the appropriate repository.

From a quick test this is what I got:

image

I reproduced the issues mentioned. This may require some fixes in generators.

I will postpone this to work on it next week.

tabacitu commented 1 year ago

I'd assign this to @maurohmartinez - I think it would be a good introduction to this repo, which needs a little bit more attention. Normally this is Antonio's baby, but I don't want to distract him from working on v6.

maurohmartinez commented 1 year ago

Closing and moving this to PR.