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

mkdir(): Invalid path #24

Closed
linslin opened this issue Jul 5, 2017 · 14 comments
Closed

mkdir(): Invalid path #24

linslin opened this issue Jul 5, 2017 · 14 comments

Comments

@linslin
Copy link

linslin commented Jul 5, 2017

Getting the following error when running php artisan code:models --table=sales_executive :

[ErrorException]
mkdir(): Invalid path

My config file is present in ./config/models.php and was created by CLI with: php artisan vendor:publish --tag=reliese-models.

Debugging $this->config in CodersServiceProvider says:

class Reliese\Coders\Model\Config#194 (1) {
  protected $config =>
  NULL
}

Any ideas?

@linslin
Copy link
Author

linslin commented Jul 5, 2017

Btw. in the config file is a function used: app_path() but this function is not declared at all.

@linslin
Copy link
Author

linslin commented Jul 5, 2017

Debugging part 2 in CodersServiceProvider.php:

    protected function registerModelFactory()
    {
        $this->app->singleton(ModelFactory::class, function ($app) {

            var_dump($app->make('config')->get('models'));
           // result: NULL

//            return new ModelFactory(
//                $app->make('db'),
//                $app->make(Filesystem::class),
//                new Classify(),
//                new Config($app->make('config')->get('models'))
//            );
        });
    }

Mhm, for one reason models is not loaded into $app->make('config') :(

@CristianLlanos
Copy link
Member

You might've forgot to run php artisan vendor:publish --tag=reliese-models

@linslin
Copy link
Author

linslin commented Jul 6, 2017

As I said before, I did run it and the config file is present in ./config/models.php Any other ideas m8?

@CristianLlanos
Copy link
Member

I've tried to replicate this problem in a fresh install of Laravel and everything works as expected. I don't have any ideas on why this is happening to you. app_path is a function declared by Laravel itself.

@CristianLlanos
Copy link
Member

Feel free to update this issue if you find more information about this behaviour.

@DamienBurkeJJ
Copy link
Contributor

Same problem here. Fresh install of Laravel and this extension;

Running php artisan vendor:publish --tag=reliese-models results in...

Copied File [/vendor/reliese/laravel/config/models.php] To [/config/models.php]
Publishing complete.

Then php artisan code:models comes back with...

  [ErrorException]       
  mkdir(): Invalid path  

Looking at laravel.log shows that it is trying to do mkdir('') so it doesn't appear to be processing config/models.php correctly - $app->make('config') does not include a models section.

@DamienBurkeJJ
Copy link
Contributor

Solved - needed a php artisan config:clear - worth adding to the readme

@CristianLlanos
Copy link
Member

Great! Thanks for sharing the solution with us :) You can make a pull request to update the readme 👍

DamienBurkeJJ added a commit to DamienBurkeJJ/laravel that referenced this issue Aug 2, 2017
@devalexandre
Copy link

I try it, but in lumen don't have php artisan cache:clear

@kdutt1597
Copy link

composer create-project --prefer-dist laravel/laravel laravel "5.2.*"
[Error Exception]
mkdir(): Invalid Path

@CristianLlanos
Copy link
Member

Have you tried clearing the config cache? #24 (comment)

@renzocastillo
Copy link

You might've forgot to run php artisan vendor:publish --tag=reliese-models

thanks Cristian!

@shrikantpardhi
Copy link

Solved - needed a php artisan config:clear - worth adding to the readme

It worked for me. thanks

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

No branches or pull requests

7 participants