You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was working on a Lumen 5.8 project and wanted to move the models for consistency with an associated Laravel project.
I discovered that you can set this yourself, as follows:
In app/Providers/AppServiceProvider.php add this at the top
use App\Console\Commands\ModelMakeCommand;
and inside the class add the following in the register method:
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->extend('command.model.make', function ($command, $app) {
return new ModelMakeCommand($app['files']);
});
}
In app/Console/Commands create a new class ModelMakeCommand.php with the following content:
<?php
namespace App\Console\Commands;
use Flipbox\LumenGenerator\Console\ModelMakeCommand as Command;
class ModelMakeCommand extends Command
{
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return "{$rootNamespace}\Models";
}
}
On Lumen 8, I have use command make model, but it generate file outside model directory.
It should be generate file in Models directory.
The text was updated successfully, but these errors were encountered: