Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 588 forks source link

Laravel 5.1 Way\Generators migration.txt template file not found problem. #121

Closed candasm closed 7 years ago

candasm commented 7 years ago

Hey @Xethron,

I wanted use your package with Laravel 5.1. When I run artisan migrate:generate command. This error appeared.

[Way\Generators\Filesystem\FileNotFound] .../vendor/way/generators/src/Way/Generators/templates/migration.txt

Seems like you extended Way\generators under your username But migration template path is hardcoded so it prompts error because of path does not exists. Also I can not install way\generators for laravel 5 because of original way\generators require's laravel 4 packages.

endachao commented 7 years ago

I have also encountered

endachao commented 7 years ago

This problem is caused by the path to the configuration file

I found a solution

New file /config/generators.config.php

Write the following

/**
 * Created by PhpStorm.
 * User: YuanChao <endachao@gmail.com>
 * Date: 2017/2/23
 */

return [

    /*
    |--------------------------------------------------------------------------
    | Where the templates for the generators are stored...
    |--------------------------------------------------------------------------
    |
    */
    'model_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/model.txt'),

    'scaffold_model_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/scaffolding/model.txt'),

    'controller_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/controller.txt'),

    'scaffold_controller_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/scaffolding/controller.txt'),

    'migration_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/migration.txt'),

    'seed_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/seed.txt'),

    'view_template_path' => base_path('vendor/xethron/laravel-4-generators/src/Way/Generators/templates/view.txt'),

    /*
    |--------------------------------------------------------------------------
    | Where the generated files will be saved...
    |--------------------------------------------------------------------------
    |
    */
    'model_target_path'   => app_path(),

    'controller_target_path'   => app_path('Http/Controllers'),

    'migration_target_path'   => base_path('database/migrations'),

    'seed_target_path'   => base_path('database/seeds'),

    'view_target_path'   => base_path('resources/views')

];

The problem is solved

baochiharris commented 7 years ago

thanks you very much.

candasm commented 7 years ago

Hello @yccphp,

Actually before I open issue here, I did the same thing as your answer. But the main problem comes because of composer.json required packages needs to be updated for laravel 5 versions.

Xethron commented 7 years ago

Thanks to everyone for helping fix this. I have updated Way/Generators with the new path: https://github.com/Xethron/Laravel-4-Generators/commit/1ba6e6ce24c64e54858fdfcc5d2e6234f9ae8eee

Doing a composer update should fix the problem