简体   繁体   English

我不明白为什么我的变量未定义

[英]I can't understand why my variable is undefined

Why in "action" URL is writing my page ID and when I want to DD() it tells that variable is undefined When I go to edit page, domainPage->id show null Look at blade为什么在“动作”中 URL 正在写入我的页面 ID,当我想 DD() 时它告诉变量未定义当我 go 编辑页面时,domainPage->id 显示 Z37A6259CC0C1DAE299A78664

{{dd($domainPage->id)}}
        <form action="{{route('admin.domain.update', ['domainPage'=> $domainPage->id])}}" enctype="multipart/form-data" method="post">
            <div class="row">
                <div class="col">
                    @method('put')
                    {{ csrf_field() }}
                    @include('admin.domains.form')
                    <div class="form-group border-top pt-3">
                        <button type="submit" class="btn btn-lg btn-block  btn-primary" >Update</button>
                    </div>
                </div>
            </div>

This is controller这是 controller

 public function edit(DomainPage $domainPage)
    {
        return view('admin.domains.edit', ['domainPage'=> $domainPage]);
    }

This is route这是路线

Route::resource('domain', 'Admin\DomainPageController')

Your model binding is not loading, you have to name your model binding class the same as your api resource.您的 model 绑定未加载,您必须将 model 绑定命名为 class 与您的 Z8A5DA52ED1205727A18AAZE7 资源相同。

public function edit(DomainPage $domain) {
    return view('admin.domains.edit', ['domain'=> $domain]);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM