Giter VIP home page Giter VIP logo

Comments (15)

tweichart avatar tweichart commented on May 18, 2024 8

I've had some problems with some functions that were missing (app_path & config_path). These steps fixed it for me:

  1. Add config file
user@local lumen % mkdir config
user@local lumen % cp vendor/reliese/laravel/config/models.php config
  1. Add the loading of the model config file & registration of class to bootstrap/app.php file
// ...
$app->configure('models');
if ($app->environment() == 'local') {
    $app->register(\Reliese\Coders\CodersServiceProvider::class);
}
// ...
  1. Add file to composer.json for definition of missing Laravel functions
{
    // ...
    "autoload-dev": {
        "files": [
            "laravel-functions.php"
        ]
    },
    // ... other entries
}
  1. Create a file in the root folder called laravel-functions.php
  2. Add missing Laravel functions that are used in the package to the laravel-functions.php file
<?php
if (!function_exists('app_path')){
    function app_path($path = ''){
        return base_path('app' . DIRECTORY_SEPARATOR . ltrim($path, '/'));
    }
}
if (!function_exists('config_path')){
    function config_path($path = ''){
        return base_path('config' . DIRECTORY_SEPARATOR . ltrim($path, '/'));
    }
}
  1. Regenerate composer autoloader file on cmd/terminal via composer dump-autoload

The separate file here can have any name, obviously.

from laravel.

CristianLlanos avatar CristianLlanos commented on May 18, 2024 2

I haven't tested this package in Lumen. I made it for Laravel. I believe we only need the Service Provider for Lumen 🤔

from laravel.

fdbatista avatar fdbatista commented on May 18, 2024 2

I've had some problems with some functions that were missing (app_path & config_path). These steps fixed it for me:

  1. Add config file
user@local lumen % mkdir config
user@local lumen % cp vendor/reliese/laravel/config/models.php config
  1. Add the loading of the model config file & registration of class to bootstrap/app.php file
// ...
$app->configure('models');
if ($app->environment() == 'local') {
    $app->register(\Reliese\Coders\CodersServiceProvider::class);
}
// ...
  1. Add file to composer.json for definition of missing Laravel functions
{
    // ...
    "autoload-dev": {
        "files": [
            "laravel-functions.php"
        ]
    },
    // ... other entries
}
  1. Create a file in the root folder called laravel-functions.php
  2. Add missing Laravel functions that are used in the package to the laravel-functions.php file
<?php
if (!function_exists('app_path')){
    function app_path($path = ''){
        return base_path('app' . DIRECTORY_SEPARATOR . ltrim($path, '/'));
    }
}
if (!function_exists('config_path')){
    function config_path($path = ''){
        return base_path('config' . DIRECTORY_SEPARATOR . ltrim($path, '/'));
    }
}
  1. Regenerate composer autoloader file on cmd/terminal via composer dump-autoload

The separate file here can have any name, obviously.

Nice tips!
These configuration steps did the job.

Thanx @tweichart

from laravel.

CristianLlanos avatar CristianLlanos commented on May 18, 2024 1

Try clearing the config cache php artisan config:clear.

from laravel.

anthonymartin avatar anthonymartin commented on May 18, 2024 1

Here's my workaround: I installed laravel and pointed it to my database. Then I installed and ran this package so I could generate the model files. I copied the model files over to my lumen project but I had to change a few things:

In the generated model files i switched use Reliese\Database\Eloquent\Model as Eloquent; to use Illuminate\Database\Eloquent\Model; and then changed the class to extend Model instead of Eloquent.

from laravel.

CristianLlanos avatar CristianLlanos commented on May 18, 2024 1

You can do that by changing this package's config file 😄 so you don't have to do it manually. The file config/models.php has a key parent that you can modify to use Illuminate\Database\Eloquent\Model. You just have to change the config file.

from laravel.

turkeryildirim avatar turkeryildirim commented on May 18, 2024 1

I had same issue. The problem is, config file not loading...

put your bootstrap/app.php file this:

$app->configure('models');

If i'm not wrong lumen does not load config files automatically. So you have to load it :)

from laravel.

netdragoon avatar netdragoon commented on May 18, 2024

The package has problems in Lumen, does not have the function "config_path ()" for example and gives an error also in the command line, it was the tests that I performe!!!

from laravel.

anthonymartin avatar anthonymartin commented on May 18, 2024

You can follow these instructions to add config_path to Lumen: https://gist.github.com/mabasic/21d13eab12462e596120

However, now I'm stuck at php artisan code:models - I get the following error:

  [ErrorException]
  mkdir(): Invalid path

I ran the following:

$ php artisan vendor:publish --tag=reliese-models
Copied File [/vendor/reliese/laravel/config/models.php] To [/config/models.php]
Publishing complete for tag [reliese-models]!

The config/models.php file exists and is exactly the same as the one found here: vendor/reliese/laravel/config/models.php

from laravel.

anthonymartin avatar anthonymartin commented on May 18, 2024

I tried that, but that command is not available in Lumen unfortunately. There's nothing in the storage/cache directory either.

from laravel.

CristianLlanos avatar CristianLlanos commented on May 18, 2024

Try looking at bootstrap/cache. If you find a file named config.php, delete it.

from laravel.

netdragoon avatar netdragoon commented on May 18, 2024

Unfortunately the package is not compatible

from laravel.

devalexandre avatar devalexandre commented on May 18, 2024

I have this problem :(

[ErrorException]
mkdir(): Invalid path

from laravel.

approached avatar approached commented on May 18, 2024

Same problem:

php artisan code:models --table="ipb2_mod_newsroom_forums_exclusive"

   ErrorException  : mkdir(): Invalid path

  at /Users/approach/workspace/IALaravel/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:492
    488|         if ($force) {
    489|             return @mkdir($path, $mode, $recursive);
    490|         }
    491|
  > 492|         return mkdir($path, $mode, $recursive);
    493|     }
    494|
    495|     /**
    496|      * Move a directory.

  Exception trace:

  1   mkdir("")
      /Users/approach/workspace/IALaravel/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:492

  2   Illuminate\Filesystem\Filesystem::makeDirectory("")
      /Users/approach/workspace/IALaravel/vendor/reliese/laravel/src/Coders/Model/Factory.php:482

  Please use the argument -v to see more details.

from laravel.

CristianLlanos avatar CristianLlanos commented on May 18, 2024

You've probably forgotten to publish the configurations. In case you are using Lumen, remember to register the appropriate configuration within your bootstrap/app.php file.

from laravel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.