Hellow,我在我的数据库中有一张桌子作为许可。我需要更新表原始。见我的edit.blade.php
@extends('layouts.app')@section('content') <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header"> Update Permission</h1>
@include('layouts.partials.alerts')
<div class="col-lg-6">
<form class="form-vertical" role="form" method="post" action="">
<div class="form-group{{ $errors->has('status') ? ' has-error' : '' }}">
<label for="status" class="control-label">Choose Status</label>
<select name="status" id="status">
<option value="{!! $permission->status !!}">{!! $permission->status !!}</option>
{{ getStatus($permission->status) }}
</select>
@if ($errors->has('status'))
<span class="help-block">{{ $errors->first('status') }}</span>
@endif
</div></div>@stop
但是我收到了这个错误
Undefined variable: permission (View: C:\Users\fernando\Desktop\c\resources\views\collaborators\edit.blade.php)
我该如何解决这个问题?
答案 0 :(得分:0)
Blade使用您从控制器传递的数据,例如返回视图(&#39; collaborators.edit&#39;,[&#39; permission&#39; =&gt; $ permission);。您可能正在获取该错误是因为您没有将权限对象发送到视图。要检查将此{{dd(get_defined_vars())}}放在@include(&#39; layouts.partials.alerts&#39;)之后将转储所有在视图范围内定义的数据检查是否有对象。