Voyager: Missing required parameters for [Route: voyager.bread.delete] [URI: admin/bread/{id}]

Created on 27 Nov 2019  路  29Comments  路  Source: the-control-group/voyager

Version information

  • Laravel: v6.6.0
  • Voyager: v1.3.0
  • PHP: 7.2
  • Database: [PgSql] [9.6] (e.g. MySQL 8.0)

Description


I just installed fresh voyager and it installed successfully, everything is openable but when i clicked on Database menu from admin panel it display's error as following.

image

Steps To Reproduce

Steps to reproduce the behavior:

  1. install voyager version 1.3
  2. login to admin panel with admin user
  3. open database menu from left side menu bar
  4. See error

Expected behavior

image

Screenshots

all screen shots attached.

Additional context

I solved this error by following these steps.
each of these steps solved my problem but i don't know which one is best.

  1. open following file
    _projectfolder\vendor\tcg\voyager\routes\voyager.php_

Add ? infornt of {id} as {id?} at following line

Route::delete('{id}', ['uses' => $namespacePrefix.'VoyagerBreadController@destroy', 'as' => 'delete']);
OR

  1. open following file

projectfolder\vendor\tcg\voyager\resources\views\tools\database\index.blade.php

replace ['id' => null] text with '' in following line

<form action="{{ route('voyager.bread.delete', ['id' => null]) }}" id="delete_bread_form" method="POST">

These steps solved my problem but which one is right one i don't know and why it exist in latest version but not in old also don't know

addressed possible bug

Most helpful comment

4587 it's already merged and will be part of next release.

All 29 comments

I have the same problem

Odd it was not giving me any error :thinking:
Anyway fixed in #4587

Thanks for the detailed report.

Hi Voyager team
I got same error with a fresh install voyager last available version
php 7.2.18
mysql 5.7.26
wamp
windows 10

Just install default without dummy
All is ok except wen I try to access database module i get this error

Facade\Ignition\Exceptions\ViewException
Missing required parameters for [Route: voyager.bread.delete] [URI: admin/bread/{id}]. (View: C:\wamp64\www\osim\vendor\tcg\voyager\resources\views\tools\database\index.blade.php)
http://127.0.0.1:8000/admin/database

I made only one change in db configuration

'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',

otherway I get the konwn error key is too long...

Any idea ?

@eletec please read my previous comment

The proposed fix does'n fix for me : same eror message

pakistanimoon solution seems ok

@eletec please check again if you applied fix correctly, if you still have the problem can you show me where is the error in index.blade.php and also line 232?
Schermata da 2019-11-28 05-41-25

index.blade changes

96 <form action="#" id="delete_bread_form"method="POST">`

232 $('table .bread_actions').on('click', '.delete', function (e) {
id = $(this).data('id');
name = $(this).data('name');

            $('#delete_bread_name').text(name);
           $('#delete_bread_form')[0].action = '{{ route('voyager.bread.delete', '__id') }}'.replace('__id', id);

            $('#delete_bread_modal').modal('show');`

I can edit / create / delete bread

I got error directly accessing database module ( I suppose id is not defined at this step)

Facade\Ignition\Exceptions\ViewException
Missing required parameters for [Route: voyager.bread.delete] [URI: admin/bread/{id}]. (View: C:\wamp64\www\osim\vendor\tcg\voyager\resources\views\tools\database\index.blade.php)

I clear all laravel caches, restart server

error detail

`
Illuminate\Routing\Exceptions\UrlGenerationException::forMissingParameters
:17
C:\wamp64\www\osim\vendor\laravel\framework\src\Illuminate\Routing\Exceptions\UrlGenerationException.php:17

namespace Illuminate\Routing\Exceptions;

use Exception;

class UrlGenerationException extends Exception

{

/**

 * Create a new exception for missing route parameters.

 *

 * @param  \Illuminate\Routing\Route  $route

 * @return static

 */

public static function forMissingParameters($route)

{

    return new static("Missing required parameters for [Route: {$route->getName()}] [URI: {$route->uri()}].");

}

}
`

Can anyone help, my solutions mentioned above are not correct? because i am working on project after applying solution number 2, should i wait for update or continue with it?

@pakistanimoon first thing you shouldn't change anything inside vendor other than for testing.

You can:

  • ADVISED: Downgrade Laravel to v6.5.2 until this gets fixed in Voyager.
  • Use your fork with fix untill this gets fixed in Voyager.

Said that as for your changes, you shouldn't change route definition and I'm quite sure the empty string is not supposed to work and it might not work in a future Laravel release if it gets fixed.

Can you try #4587?
I'm not sure why is not working for @eletec, it's working fine for me.

4587 fixes the issue for me. Just upgraded to Laravel 6.6 and Voyager's Database crashed for me. Was about to write an issue but I can use this patch for now until it gets resolved.

I have the same issue and see the changes from https://github.com/laravel/framework/pull/30659/files are already in my system.

"laravel/framework": "^6.0"
"tcg/voyager": "^1.3"

Facade\Ignition\Exceptions\ViewException
Missing required parameters for [Route: voyager.bread.delete] [URI: admin/bread/{id}]. (View: $HOME/laravel/vendor/tcg/voyager/resources/views/tools/database/index.blade.php)

From Telescope...
ErrorException
Trying to get property 'name' of non-object

go to 'vendor/tcg/voyager/resources/views/tools/database/index.blade.php' line 96 write:
<form action="#" id="delete_bread_form" method="POST">

That works... thanks.
Do we have an idea when this will be put into the newest version?

4587 it's already merged and will be part of next release.

I have similar problem with Builder page for admin menu. i put the fix #4587 but with no result
builder

For fix this i downgraded laravel to 6.5.2 instead of laravel 6.7.0

@neapolis79 as you said it's similar but not the same, there is another PR for that #4606.
And yes downgrading Laravel is the easiest work around until next Voyager version is realeased

ok just to know i override builder.blade.php view with the fix you referred and works also with laravel 6.7.0 thanks

4587 it's already merged and will be part of next release.

Are there any planning on releasing next update? When it will be?
Thanks.

it is definitely not wise to edit any vendor package, because we all know that things are going to be really messy on the next update.
I am also working on a fix.

image

well adding another condition to it works!

following

Missing required parameters for [Route: voyager.menus.item.destroy] [URI: admin/menus/{menu}/item/{id}].

This is what i'm receiving from a fresh voyager installation with dummy data, installed 22nd Dec 2019

the error seems to be connected with tcg/voyager/resources/views/menus/builder

    <form action="{{ route('voyager.menus.item.destroy', ['menu' => $menu->id, 'id' => '__id']) }}"
                          id="delete_form"
                          method="POST">

@doubleprincez please read previous comments or search in issues #4623

Version information

* Laravel: v6.6.0

* Voyager: v1.3.0

* PHP: 7.2

* Database: [PgSql] [9.6] (e.g. MySQL 8.0)

Description

I just installed fresh voyager and it installed successfully, everything is openable but when i clicked on Database menu from admin panel it display's error as following.

image

Steps To Reproduce

Steps to reproduce the behavior:

1. install voyager version 1.3

2. login to admin panel with admin user

3. open database menu from left side menu bar

4. See error

Expected behavior

image

Screenshots

all screen shots attached.

Additional context

I solved this error by following these steps.
each of these steps solved my problem but i don't know which one is best.

1. open following file
   _projectfolder\vendor\tcg\voyager\routes\voyager.php_

Add ? infornt of {id} as {id?} at following line

Route::delete('{id}', ['uses' => $namespacePrefix.'VoyagerBreadController@destroy', 'as' => 'delete']);
OR

1. open following file

projectfolder\vendor\tcg\voyager\resources\views\tools\database\index.blade.php

replace ['id' => null] text with '' in following line

<form action="{{ route('voyager.bread.delete', ['id' => null]) }}" id="delete_bread_form" method="POST">

These steps solved my problem but which one is right one i don't know and why it exist in latest version but not in old also don't know

THANK U SO MUCH

@loooping It's strange that you just installed 1.3.0 when 1.3.1 is available, please update it's fixed in last release.

on voyager v1.3.2 these trick works for me here

BTW. This also happens if the value for your primary key is NULL, which indicates a problem with your data. The message is misleading.

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings