Skip to content

Instantly share code, notes, and snippets.

@wedojava
Created March 25, 2015 09:59
Show Gist options
  • Select an option

  • Save wedojava/41296a19a759a57c3d6d to your computer and use it in GitHub Desktop.

Select an option

Save wedojava/41296a19a759a57c3d6d to your computer and use it in GitHub Desktop.

Revisions

  1. wedojava created this gist Mar 25, 2015.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    放个例子:
    视图:{!!Form::select('difficulty', $difficulties)!!}

    控制器:
    public function edit($id)
    {
    return view('admin.questions.edit')
    ->withQuestion(Question::find($id))
    ->withDifficulties(Difficulty::lists('name', 'id'));
    }

    关键问题在于这一句:Difficulty::lists('name', 'id')