Open affordableprogrammer opened 9 years ago
I got like what you are trying to do. And I think now all your files are generated at proper places/paths given in config/generator.php
.
so like what's the problem ? What do you mean by they are not aligning with the output of the crud correctly.
?
You mean any routes problem is there when you run CRUD ? Or can you host your code with generated files at somewhere from where I can check it on my machine ?
Let me host them and give you a link. give me a couple days.
sure.
https://github.com/mitulgolakiya/laravel-api-generator/issues/73#event-387310159
Sorry you closed the issue before I finished trying what you said to try.
Here are the problems im having now. 1- I added the changes to the path and namespace in config like you said but they are not correcting the paths only adding the files into the proper place. so I get the placemenet of files im trying for but all the forms, routes and connections are wrong.
let me explain what im trying to do. I am trying to use your crud builder to generate my admin side for each section. I then have a front end , lets say live site for the public that I would also like to generate just index and view for but cannot figure out how to do this.
USERS EXAMPLE
Users
Controller
(these are the main files generated but im trying to put them in a admin directory and have the paths still work .)
(need to generate these files that output the fields like show.blade.php does. nothing else no theme or anything. )
Here is my config file with my edits per your solution.
'path_migration' => base_path('database/migrations/'), 'path_model' => app_path('Models/Admin/'), 'path_repository' => app_path('Libraries/Repositories/'), 'path_controller' => app_path('Http/Controllers/Admin/'), 'path_api_controller' => app_path('Http/Controllers/API/'), 'path_views' => base_path('resources/views/admin/'), 'path_request' => app_path('Http/Requests/'), 'path_routes' => app_path('Http/Routes/admin_routes.php'),
(I added the routes directory to keep the route files easy to read and smaller. I am attaching the script I use in my routes file to make it happen. you might like it.)
'namespace_model' => 'App\Models_Admin', 'namespace_repository' => 'App\Libraries\Repositories', 'namespace_controller' => 'App\Http\Controllers\Admin_', 'namespace_api_controller' => 'App\Http\Controllers\API', 'namespace_request' => 'App\Http\Requests',
My edit to routes.txt file
Route::get('admin/$MODEL_NAME_PLURAL_CAMEL$/{id}/delete', ['as' => 'admin.$MODEL_NAME_PLURAL_CAMEL$.delete', 'uses' => 'Admin\$MODEL_NAME$Controller@destroy', ]);
ROUTES FILE SWITCH SCRIPT.
foreach (new DirectoryIterator(__DIR__.'/Routes') as $file) { if (!$file->isDot() && !$file->isDir() && $file->getFilename() != '.gitignore') { require_once __DIR__.'/Routes/'.$file->getFilename(); } }
This image is of my routes after I made the changes. Problem is they are not aligning with the output of the crud correctly.
ANY HELP WOULD BE APPRECIATED.