thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.81k stars 2.67k forks source link

error when create/update menu item #4790

Open newbie78 opened 4 years ago

newbie78 commented 4 years ago

4145 Version information

Description

SQLSTATE[42S22]: Column not found: 1054 Unknown column '/admin/menus/1/item' in 'field list' (SQL: insert into `menu_items` (`title`, `url`, `route`, `parameters`, `icon_class`, `color`, `target`, `menu_id`, `/admin/menus/1/item`, `order`, `updated_at`, `created_at`) values (asdasdasd, , ?, , ?, #000000, _self, 1, ?, 15, 2020-02-28 11:22:43, 2020-02-28 11:22:43))

when create/update menu item

Steps To Reproduce

  1. fresh install with --with-dummy flag
  2. go to /admin/menus/1/builder
  3. click on + New Menu Item
  4. enter Title, then click Add
  5. see error
fletch3555 commented 4 years ago

Do you have a full stacktrace for this? The error alone doesn't provide enough information to track this down

newbie78 commented 4 years ago

Do you have a full stacktrace for this? The error alone doesn't provide enough information to track this down

https://flareapp.io/share/xPQk6k51#F58

fletch3555 commented 4 years ago

In context, the error makes sense. This url isn't valid: http://radio.test/admin/menus/1/item?%2Fadmin%2Fmenus%2F1%2Fitem=

What did you click to get there?

newbie78 commented 4 years ago

I noticed that when I click on Add button, popup is closed and url changes. then i got this error.

newbie78 commented 4 years ago

is there any news?

newbie78 commented 4 years ago

i found where is the problem.

    public function add_item(Request $request)
    {
        $menu = Voyager::model('Menu');

        $this->authorize('add', $menu);

        $data = $this->prepareParameters(
            $request->request->all()
            // $request->all()
        );
    public function update_item(Request $request)
    {
        $id = $request->input('id');
        $data = $this->prepareParameters(
            $request->request->all()
            // $request->request->except(['id'])
        );
        unSet($data['id']);

if you change VoyagerMenuController.php in that two places, then menu builder worked fine.

is PR from me needed?