thedevdojo / voyager

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

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

Closed pakistanimoon closed 4 years ago

pakistanimoon commented 4 years ago

Version information

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

mweikat commented 4 years ago

I have the same problem

MrCrayon commented 4 years ago

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

Thanks for the detailed report.

eletec commented 4 years ago

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 ?

MrCrayon commented 4 years ago

@eletec please read my previous comment

eletec commented 4 years ago

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

pakistanimoon solution seems ok

MrCrayon commented 4 years ago

@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

eletec commented 4 years ago

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

eletec commented 4 years ago

error detail

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

<?php

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()}].");

}

} `

pakistanimoon commented 4 years ago

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?

MrCrayon commented 4 years ago

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

You can:

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.

hirbod commented 4 years ago

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.

rsecor commented 4 years ago

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

afrooseh commented 4 years ago

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

rsecor commented 4 years ago

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

MrCrayon commented 4 years ago

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

neapolis79 commented 4 years ago

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

MrCrayon commented 4 years ago

@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

neapolis79 commented 4 years ago

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

skys215 commented 4 years ago

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.

clemkake commented 4 years ago

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.

clemkake commented 4 years ago

image

well adding another condition to it works!

johncarlson21 commented 4 years ago

following

doubleprincez commented 4 years ago

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">
MrCrayon commented 4 years ago

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

loooping-old commented 4 years ago

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

MrCrayon commented 4 years ago

@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.

hanhabesha commented 4 years ago

on voyager v1.3.2 these trick works for me here

lesichkovm commented 4 years ago

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

github-actions[bot] commented 3 years ago

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.