mitulgolakiya / laravel-api-generator

Laravel API/Scaffold/CRUD Generator including Controller, Repository, Model, Migrations, routes.php update.
MIT License
681 stars 144 forks source link

update to closed issue #91

Open affordableprogrammer opened 9 years ago

affordableprogrammer commented 9 years ago

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

(need to generate these files that output the fields like show.blade.php does. nothing else no theme or anything. )

'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(); } } my-routes

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.

mitulgolakiya commented 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 ?

affordableprogrammer commented 9 years ago

Let me host them and give you a link. give me a couple days.

mitulgolakiya commented 9 years ago

sure.