Skip to content

generator does not work if paths are changed in laravel-generator config file #70

@vesper8

Description

@vesper8

This is a bug that's existed for a long time with the old (mitul) version.

If you modify the paths in the generator.php config file (now laravel-generator.php) then it will correctly create the files in the subfolder specified, but all the view('') lines in the controllers and the @include('') in the views will not reflect the subfolder and will thus fail to load, requiring that you manually add the subfolder to all of those.

example

generator.php contains:

'views' => base_path('resources/views/MySubFolder/'),

inside the controllers, for a model named MyModel it will create

return view('mymodel.show')->with('mymodel', $mymodel);

but it needs to be

return view('MySubFolder.mymodel.show')->with('mymodel', $mymodel);

And the views themselves will try have

@include('index.blade')

but needs to be

@include('MySubFolder.index.blade')

Another bug is that the requests that are generated in the subfolder will try to load the main laravel request from the subfolder but it exists in the root

example

use App\MySubFolder\Http\Requests\Request;
should remain
use App\Http\Requests\Request;

Everything else works correctly when changing the paths in the generator config file so I think this should be addressed so it is fully funtionnal with different paths.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions