Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a CRUD Generator to the admin options #228

Closed
wants to merge 27 commits into from
Closed

Adding a CRUD Generator to the admin options #228

wants to merge 27 commits into from

Conversation

DeveloperOnCall
Copy link

I have added the CRUD Generator to the admin options.

With this, users can begin creating apps easier/faster using the laravel-auth starter system

  • New CRUD generation system that generates all the Models, Views, Controllers, Routes etc - based on the values provided in the form ( /crud)

  • Added a menu item to the CRUD route

  • Customized the crud-generator slugs to match laravel-auth

  • Enabled WYSIWYG on all add/edit items in newly generated CRUD modules

/**
* Make sure we do not already have this module
*/
$directories = glob(base_path() . '/resources/views/*' , GLOB_ONLYDIR);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space found before comma in function call

*/
$directories = glob(base_path() . '/resources/views/*' , GLOB_ONLYDIR);
foreach( $directories as $dir ){
$this_name = str_replace(base_path() . '/resources/views/','',$dir);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space found after comma in function call

}
//dd($request->crud_name);

if(in_array(strtolower($request->crud_name),$used_names)){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Expected 1 space after IF keyword; 0 found
  • No space found after comma in function call
  • Expected 1 space after closing parenthesis; found 0


return redirect('crud')->with('flash_message', 'Your CRUD has been generated. See on the menu.');
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 newline at end of file; 0 found

* Make sure we do not already have this module
*/
$directories = glob(base_path() . '/resources/views/*', GLOB_ONLYDIR);
foreach ( $directories as $dir ){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Space found after opening bracket of FOREACH loop
  • Space found before closing bracket of FOREACH loop
  • Expected 0 spaces after opening bracket; 1 found
  • Expected 0 spaces before closing bracket; 1 found
  • Expected 1 space after closing parenthesis; found 0

}
//dd($request->crud_name);

if (in_array(strtolower($request->crud_name), $used_names)){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 space after closing parenthesis; found 0


// Make sure we do not already have this module
$directories = glob(base_path().'/resources/views/*', GLOB_ONLYDIR);
foreach ($directories as $dir){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 space after closing parenthesis; found 0

use Illuminate\Http\Request;
use Redirect;
use Response;
use View;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be one blank line after the last USE statement; 2 found;

// Make sure we do not already have this module
$directories = glob(base_path().'/resources/views/*', GLOB_ONLYDIR);
foreach ($directories as $dir){
$this_name = str_replace(base_path().'/resources/views/','',$dir);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space found after comma in function call

// Make sure we do not already have this module
$directories = glob(base_path().'/resources/views/*', GLOB_ONLYDIR);
foreach ($directories as $dir){
$this_name = str_replace(base_path().'/resources/views/', '',$dir);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space found after comma in function call

$name = $commandArg['name'];
$routeName = ($commandArg['--route-group']) ? $commandArg['--route-group'].'/'.snake_case($name, '-') : snake_case($name, '-');

$menus->menus = array_map(function($menu) use ($name, $routeName) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 space after FUNCTION keyword; 0 found

@jeremykenedy
Copy link
Owner

I get a 404 when I go to /crud and do not see a route in web.php

@jeremykenedy
Copy link
Owner

jeremykenedy commented Jan 6, 2019

I think the console/artisan command is not there. I am getting the error:

The command "crud:generate" does not exist.

Thank you for putting this together!

@DeveloperOnCall
Copy link
Author

DeveloperOnCall commented Jan 7, 2019

@jeremykenedy My bad -- we can pretend this didn't happen... lol I didn't bring down the composer changes, sorry about that.

Should also do a composer install as part of this update.

@jeremykenedy
Copy link
Owner

When I try to create a new item I get the following error:

File does not exist at path /home/vagrant/code/laravel-auth/resources/crud-generator//controller.stub

@jeremykenedy
Copy link
Owner

I just pulled the recent pushes and am getting the following error:

File does not exist at path /home/vagrant/Code/laravel-auth/resources/crud-generatorviews/laravelcollective/form-fields/form-field.blade.stub

I see the file there thought.

…ome issues when using custom template locations.
@DeveloperOnCall
Copy link
Author

DeveloperOnCall commented Jan 10, 2019

Trying to do it with no edits to the included package. However, there may be some problem with their use of a custom template path. Give this a try. Any problems with the location and I'll make a change to the crudgenerator package and submit to them a pull request.

I fixed it in their code and submitted a pull request -- but no one has submitted it as an issue so their system should work despite the problem in those couple of files.

D

@DeveloperOnCall
Copy link
Author

@jeremykenedy Is this still giving you problems?

@jeremykenedy
Copy link
Owner

I think that last issue I ran into was it duplicating migrations that exist, so there was some validation.

Then when I was able to create a model It had an issue with dynamically calling the model.

I think it was the line

use App\{{useModel}};

I need to put some more time into testing it, I have been swamped lately. This is totally still up on my radar.

Thank you again for putting this together.

@jeremykenedy
Copy link
Owner

jeremykenedy commented Feb 18, 2019

I was able to get past the error previously mentioned but I feel adding a crud controller is error prone.

There are a lot of little things that need work:

  1. Validations of existing models and migrations.
  2. HTML rendering.
  3. Middlewares to use.
  4. Auth and Roles restrictions on editing/viewing/deleting.
  5. Flash Messages.
  6. Using alert() with actions rather than bootstrap models.
  7. Models not going to into the models folder.
  8. Adding whitespaces in the generated code.
  9. Html render errors in the WYSWYG where the table tools display in the upper left-hand corner.
  10. Language file usage in forms and messages is missing.

Some/most of these issues stem from the original package used.

It has some neat things but I am having trouble seeing the use case for this project. I am wondering what use cases it would work if you can help me see those.

I have created a branch with some of the fixes in order to get it past the original errors that hindered me to test it but the list still remains:

https://github.com/jeremykenedy/laravel-auth/tree/crudbuilder

@DeveloperOnCall
Copy link
Author

DeveloperOnCall commented Feb 18, 2019 via email

@jeremykenedy
Copy link
Owner

jeremykenedy commented Feb 18, 2019

Gotcha, for the roles/auth part: a user can CRUD items without even being logged into the application so it becomes a security issue.

The app was originally a starter project but evolved to something more so in order to protect the integrity and security of it I need to be careful about adding things that can cause issues or introduce security vulnerabilities. The PR just introduces too many security issues and has too many errors.

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants