douju1928 2017-09-16 01:42
浏览 53

发出传递参数Form :: Open Laravel

Fairly new at Laravel and trying to grasp the store function and routing. I'm getting the following error trying to open a form in Laravel:

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

The issue is because my url is:

/projects/1/documents/create

And I'm opening to:

/projects/1/documents

I'm trying to pass the projects ID but I'm missing something.

Form Call:

{!! Form::open(['route'=>'projects.documents.store', $project->id]) !!}
     @include('pages.projects.documents.charter.partials._form', ['submitButtonText'=>'Create Project Charter'])
{!! Form::close() !!}

My Web Route (I'm assuming the issue is here):

// Resource route for Project Document Controller
Route::resource('projects.documents', 'Project\DocumentController');

My DocumentController store function:

public function store(Request $request, Project $project)
{
    // Validate the request
}

I'm not sure if there is any other sections of code that are need. The page renders fine without Form::open and $project->id echo's out correctly.

Edit:

I figured out my issue, it was somewhat silly. Just not use to Laravel formatting yet. The route & param needed to be in an array. The correct formatting is:

{!! Form::open(['route'=>array('projects.documents.store', $project->id)]) !!}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端