webNeat / lumen-generators

A collection of generators for Lumen and Laravel 5.
MIT License
353 stars 95 forks source link

Adding a model inside a directory does not add the directory to the namespace, and includes the directory in the classname #38

Open AlexJDG opened 7 years ago

AlexJDG commented 7 years ago

Using the command php artisan wn:model Models/Product generates Products.php inside the Models directory as expected but does not add the \Models postfix to the namespace and sets the class name as Models/Product.

Using PHP 7.1 and Lumen 5.4

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Models/Product extends Model {

    protected $fillable = [];

    protected $dates = [];

    public static $rules = [
        // Validation rules
    ];

    // Relationships

}
webNeat commented 7 years ago

Hello, please try:

php artisan wn:model Product --path="app/Models"

the name argument should be the single name of the model; the path should be specified using the --path option.