【问题标题】:Missing required parameters for [Route: roles.destroy][Route: roles.destroy] 缺少必需的参数
【发布时间】:2020-10-09 06:32:46
【问题描述】:

我发现了这个错误 [Route: roles.destroy] [URI: roles/{role}] 缺少必需的参数。 (查看:E:\wamp64\www\student_system\resources\views\roles\table.blade.php)

<div class="table-responsive">
<table class="table" id="roles-table">
    <thead>
        <tr>
            <th>Name</th>
            <th colspan="3">Action</th>
        </tr>
    </thead>
    <tbody>
    @foreach($roles as $role)
        <tr>
            <td>{{ $role->name }}</td>
            <td>
                {!! Form::open(['route' => ['roles.destroy', $role->id], 'method' => 'delete']) !!}
                <div class='btn-group'>
                    <a href="{{ route('roles.show', [$role->id]) }}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
                    <a href="{{ route('roles.edit', [$role->id]) }}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
                    {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
                </div>
                {!! Form::close() !!}
            </td>
        </tr>
    @endforeach
    </tbody>
</table>

【问题讨论】:

  • 欢迎来到 SO ... 你的代码在哪里?
  • 嗨@Muhammad Imran,您能分享what you have tried 来解决上述问题吗?

标签: laravel error-handling infyom


【解决方案1】:

我从未使用过 Form 类,但我认为您可以尝试只传入 $role。

【讨论】:

  • 试试这个:{!! Form::open(['url' => route('roles.destroy', ['role' => $role->id]), 'method' => 'delete']) !!}
猜你喜欢
  • 2018-10-28
  • 1970-01-01
  • 1970-01-01
  • 2018-10-28
  • 2020-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多