我可能做错了,但是我尝试更新octobercms中的帖子。这就是我现在所拥有的。
这是编辑按钮:
<td>
<a href="{{ 'post-edit'|page ({ id: post.id }) }}">
<button class="btn btn-sm btn-success">Edit</button>
</a>
</td>
然后进入编辑页面:
<?php
use Corymillz\Adverts\Models\Advert;
function onStart() {
$slug = $this->param('slug');
}
function onUpdate() {
$id = post('edit');
$this['post'] = Advert::find($id)->where('id', $slug)->update();
}
?>
嫩枝
<form data-request="update" data-request-validate data-request-flash
data-request-files id="edit1" data-request-data="edit: {{ post.id }}">
<div class="container">
<div class="form-group required">
<small>
<b>
<label class="float-left control-label" >Title</label>
</b>
</small>
<input id="pro_title" type="text" name ="title"
class="form-control form-control-sm" aria-describedby="title"
value="{{ post.title }}" autocomplete="off" required>
</div>
</div>
...
</form>
我在做什么不对?