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 MakeSettingsClass command speeds up the process #126

Closed
wants to merge 1 commit into from

Conversation

egyjs
Copy link

@egyjs egyjs commented Mar 29, 2022

No description provided.

Copy link
Member

@rubenvanassche rubenvanassche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, added some small comments + could you add a test checking that the command is working?

protected function getStub()
{
return __DIR__.'/stubs/settingClass.stub'; // todo: add stubs to package!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove newline here

src/Console/MakeSettingsClass.php Show resolved Hide resolved

protected function buildClass($name): array|string
{
$class = parent::buildClass($name); // todo: uncomment after stubs added to package!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment here

{
return $rootNamespace.'\Settings';
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove newline

}

return $class;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline


use Illuminate\Console\GeneratorCommand;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove newline

$class = parent::buildClass($name); // todo: uncomment after stubs added to package!

if ($this->option('group')) {
$class = str_replace(['DummyView','{{ group }}'], $this->option('group'), $class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use of DummyView here?

Could we dynamically deduce group from the name? Name probably always will be something like CreateBlogPostSettings if we take BlogPost from that we can make it snake case so it would look like blog_post. Off course we would keep the group command parameter to manually set the group.

Comment on lines +9 to +14
/**
* The app name.
*
* @return string
*/
// protected $appName = 'Laravel Settings';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not add this to an empty Settings class

@rubenvanassche
Copy link
Member

Closing this due to inactivity

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

Successfully merging this pull request may close these issues.

None yet

2 participants