kEpEx / laravel-crud-generator

php artisan command to generate fully working crud with grid paginated server side only by having database tables
MIT License
99 stars 44 forks source link

error al procesar el make:crud #22

Open isjjas opened 4 years ago

isjjas commented 4 years ago

al ejecutar este comando me sale el siguiente mensaje de error php artisan make:crud Zonas

Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined function CrudGenerator\Console\Commands\str_plural()

gracias por tu colaboracion

messersm commented 4 years ago

Same here, using Laravel 7.

This is due to using Laravel > 5.6, which replaced str_plural() with Str::plural(), same for Str::singular() and Str::contains().

Workaround:

Add these functions as global functions manually: Add app/Helpers/helpers.php:

<?php
use Illuminate\Support\Str;

function str_plural(...$args) {
    return Str::plural(...$args);
}

function str_singular(...$args) {
    return Str::singular(...$args);
}

function str_contains(...$args) {
    return Str::contains(...$args);
}

Register with composer autoload: composer.json:

    "autoload": {
       ...
        "files": [
            "app/Helpers/helpers.php"
        ]
    }

Re-read autoloaded files: $ composer dump-autoload

In the long term, I think it would be best to deprecate Laravel <= 5.6 in the package or add a new Version for Laravel >= 5.6.

@kEpEx If you want, I can implement these changes and thanks for the package!

kEpEx commented 4 years ago

thanks @messersm I will try to update in few next days or if you send a PR I can publish it as well if you like to contribute!

Thanks

jechaviz commented 3 years ago

This is the fix, it only works for laravel 8 for the routes, I just couldn't figured out how to pull request

https://www.dropbox.com/s/4a2o8gen4hnfu8j/kepex.zip?dl=1

If you want to use the fix, just add the uncompresed folder to vendor, and that's it.