outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
278 stars 97 forks source link

Why I got 404 on nova-settings url ? #190

Open sergeynilov opened 6 days ago

sergeynilov commented 6 days ago

I have installed outl1ne/nova-settings "^5.2" into Laravel 10 / nova 4.27 app and with default config file config/nova-settings.php :

<?php

return [

    /**
     * Set a name for the settings table
     */
    'table' => 'nova_settings',

    /**
     * URL path of settings page
     */
    'base_path' => 'nova-settings',

    /**
     * Reload the entire page on save. Useful when updating any Nova UI related settings.
     */
    'reload_page_on_save' => false,

    /**
     * We need to know which eloquent model should be used to retrieve your permissions.
     * Of course, it is often just the default model but you may use whatever you like.
     *
     * The model you want to use as a model needs to extend the original model.
     */
    'models' => [
        'settings' => \Outl1ne\NovaSettings\Models\Settings::class,
    ],

    /**
     * Show the sidebar menu
     */
    'show_in_sidebar' => true
];

In NovaServiceProvider class I defined settings itens as :

    public function boot()
    {
        parent::boot();

//        if ( ! App::isLocal()) {
//            Nova::globalSearchDebounce(2);
//        }

        \Outl1ne\NovaSettings\NovaSettings::addSettingsFields([
            Boolean::make(NovaSettingsParamEnum::USER_ACTIVE_ON_REGISTER->value,
                fn() => $this->resolveUserActiveOnRegisterValue()),
            Text::make(NovaSettingsParamEnum::CONTACT_US_EMAIL->value, fn() => $this->resolveContactUsEmailValue()),
            Number::make(NovaSettingsParamEnum::INVOICE_DAYS_BEFORE_EXPIRE->value,
                fn() => $this->resolveInvoiceDaysBeforeExpireValue()),
        ],
            [
                NovaSettingsParamEnum::USER_ACTIVE_ON_REGISTER->value => 'boolean',
                NovaSettingsParamEnum::CONTACT_US_EMAIL->value => 'string',
                NovaSettingsParamEnum::INVOICE_DAYS_BEFORE_EXPIRE->value => 'integer',
                // ...
            ]
        );
    }

I left 3rd parameter as empty (default 'general' value).

I see new menu item :

https://img001.prntscr.com/file/img001/pNaA_ELwQ-inT8HKEPWgHA.png

but clicking on the menu item I got 404 error and I can not enter settings page.

I run commands :

php artisan route:clear
php artisan config:clear
php artisan cache:clear
php artisan view:clear

The same result.

In php artisan route:list command I see :

  DELETE    nova-api/nova-settings/{path}/field/{fieldName} .......................................................................................................................................................... Outl1ne\NovaSettings › SettingsController@deleteImage

...

GET|HEAD  nova-vendor/nova-settings/settings ........................................................................................................................................................... nova-settings.get › Outl1ne\NovaSettings › SettingsController@get
  POST      nova-vendor/nova-settings/settings ......................................................................................................................................................... nova-settings.save › Outl1ne\NovaSettings › SettingsController@save
...
  GET|HEAD  nova/nova-settings/{pageId?} ................................................................................................................................................................................................................................... 

What did I miss in my settings ?

Tarpsvo commented 6 days ago

image Did you add it to the tools?

sergeynilov commented 6 days ago

Yes, and the plugin works ok when I read some parameter from db

sergeynilov commented 5 days ago

I salved this issue after I began using local server with url

php artisan serve

with url for my app

http://127.0.0.1:8000/

Before that I used virtual host of apache 2 under kubuntu 22.04 with php 8.2.

That seems strange for me, but are there some common known errors with virtual host of apache?