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

Documentation confusing #158

Closed
OvalMedia opened this issue Oct 18, 2022 · 3 comments
Closed

Documentation confusing #158

OvalMedia opened this issue Oct 18, 2022 · 3 comments

Comments

@OvalMedia
Copy link

Trying to follow the documentation I stumbled upon https://github.com/spatie/laravel-settings#usage
It says to create a GeneralSettings class that extends Settings. But you don't mention where to create this class and what Settings class it extends from. I figured it must be Spatie\LaravelSettings\Settings but nonetheless, the documentation is lacking clarity here.

@hamzaelmaghari
Copy link
Contributor

hamzaelmaghari commented Oct 27, 2022

Trying to follow the documentation I stumbled upon https://github.com/spatie/laravel-settings#usage It says to create a GeneralSettings class that extends Settings. But you don't mention where to create this class and what Settings class it extends from. I figured it must be Spatie\LaravelSettings\Settings but nonetheless, the documentation is lacking clarity here.

Hi,
Where to create the Class? You can create it anywhere you want just keep in mind to register the class in config/settings.php ...

    /*
     * Each settings class used in your application must be registered, you can
     * put them (manually) here.
     */
    'settings' => [

    ],

If you don't want to register every class, you can simply keep the array empty and change the auto_discover_settings directive bellow.

    /*
     * The package will look for settings in these paths and automatically
     * register them.
     */
    'auto_discover_settings' => [
        app()->path('example/path'),
    ],

@OvalMedia
Copy link
Author

That is useful information and should be put into the docs.

@rubenvanassche
Copy link
Member

In my opinion the docs aren't confusing, you're IDE should support you with importing the Settings class, that being said it is maybe a bit of a struggle for new programmers so I've added a single import statement within the docs to make that clear.

As for where to store your settings classes as @hamzaelmaghari, you're free to do so anywhere within your application. The docs are also describe how to point the package to these settings classes or to use auto discovery. I don't think we should tell developers where to put their classes because there are a lot of valid different styles to structure your app. As with almost any class in Laravel, you can put it everywhere due to autoloading.

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

3 participants