我需要通过edit.blade.php文件
更新My Permission表raw 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"> Edit Project</h1>
@if($permission)
@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>
</div>
</form>
</div>
@endif
</div>
@stop
我的控制器方法是这个
public function edit($id)
{
$permission = Permission::find($id);
return view('collaborators.edit')->withPermission($permission);
}
但是当我点击编辑按钮编辑.blade.php时,它只显示
Edit Project
无法看到mu下拉选择状态我的权限模型是
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Permission extends Model
{
protected $table = 'permissions';
protected $fillable = ['status','project_id','collaborator_id'];
public function scopeProject($query, $id)
{
return $query->where('project_id', $id);
}
public function project_collaborator()
{
return $this->belongsToMany('App\Collaboration','collaborator_id');
}
//
}
我该如何解决这个问题?
答案 0 :(得分:-1)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrap-input">
<label>
<input type="checkbox" id="main-dish-9">Id 9</label>
</div>
<div class="wrap-input">
<label>
<input type="checkbox" id="sub-dishes-cuisine-category-12">Id 9</label>
</div>
<div class="wrap-input">
<label>
<input type="checkbox" id="sub-dishes-cuisine-category-17">Id 9</label>
</div>
<div class="wrap-input">
<label>
<input type="checkbox" id="sub-dishes-cuisine-category-18">Id 9</label>
</div>
<div class="wrap-input">
<label>
<input type="checkbox" id="main-dish-12">Id 9</label>
</div>
<div class="wrap-input">
<label>
<input type="checkbox" id="sub-dishes-cuisine-category-11">Id 9</label>
</div>
<div class="wrap-input">
<label>
<input type="checkbox" id="sub-dishes-cuisine-category-21">Id 9</label>
</div>
在这里你必须设置action =&#34;&#34;也许这个{{/ edit}}取决于你的路线