lumen-generators icon indicating copy to clipboard operation
lumen-generators copied to clipboard

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

Open AlexJDG opened this issue 7 years ago • 1 comments

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

}

AlexJDG avatar Jul 04 '17 10:07 AlexJDG

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.

webNeat avatar Jul 04 '17 11:07 webNeat