php - laravel 5 edit elequent not working -


i trying edit data field following elequent not picking data, appreciated.

following data controller using:

  public function edit($name) {      $category = category::where('name', $name)->get()->all();      dd($category);      return view('/editcategory')->with('category', $category);  } 

while checking output not picking data db output:

array:1 [▼   0 => category {#190 ▼     #table: "category"     #connection: null     #primarykey: "id"     #perpage: 15     +incrementing: true     +timestamps: true     #attributes: array:5 [▶]     #original: array:5 [▶]     #relations: []     #hidden: []     #visible: []     #appends: []     #fillable: []     #guarded: array:1 [▶]     #dates: []     #dateformat: null     #casts: []     #touches: []     #observables: []     #with: []     #morphclass: null     +exists: true   } ] 

don't use both get() , all() in same time. should be:

public function edit($name) {      $category = category::where('name', $name)->all();      [...]  } 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -