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

The command php artisan module:make-factory generate double namespace separator #1985

Open
semsphy opened this issue Nov 18, 2024 · 1 comment
Labels

Comments

@semsphy
Copy link
Contributor

semsphy commented Nov 18, 2024

Versions:

  • laravel-modules Version: v11.1.4
  • Laravel Version: v11.30.0
  • PHP Version: v8.3.12

Description:

The command php artisan module:make generate double namespace separator.

Steps To Reproduce:

  • Configure the the modules.namespace = Custom\Modules
  • Execute the command php artisan module:make Blog
  • Execute the command php artisan module:make-factory Post Blog
  • From Custom/Modules/Blog/database/factories/PostFactory.php, checks its content

Actual Content

Generated double separators protected $model = \Custom\Modules\Blog\Models\\Post::class;

<?php

namespace Modules\Custom\Blog\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

class PostFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     */
    protected $model = \Custom\Modules\Blog\Models\\Post::class;

    /**
     * Define the model's default state.
     */
    public function definition(): array
    {
        return [];
    }
}

Expected Content

Generated protected $model = \Custom\Modules\Blog\Models\Post::class;, ONLY one single separator.

@semsphy semsphy added the bug label Nov 18, 2024
@dcblogdev
Copy link
Collaborator

I've ran through your sets and cannot replicate the problem.

In my config: 'namespace' => 'Custom\Modules',

Generated a blog module and the factory generated is:

<?php

namespace Custom\Modules\Blog\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

class PostFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     */
    protected $model = \Custom\Modules\Blog\Models\Post::class;

    /**
     * Define the model's default state.
     */
    public function definition(): array
    {
        return [];
    }
}

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

No branches or pull requests

2 participants