

M层
class Course extends Model
{
public function Klasses(){
return $this->belongsToMany('Klass', config('databa
}
C层
------------------------------------------------------------
public function add()
{
$this->assign('Course', new SmallCourse);
return $this->fetch();
}
V层
--------------------------------------------------------------------------------
{volist name="Course->Klasses()->select()" id="klass"}
<input type="checkbox" name="klass_id[]" id="klass_id_{$klass->id}" value="{$klass->id}" />
<label for="klass_id_{$klass->id}">{$klass->name}</label>
{/volist}
最佳答案
