简体   繁体   中英

Undefine Method in Laravel-5?

Please can anybody tell me how can i fix this error.I'm new in the laravel so i cannot understand the methods. Please help me to fix this error.

undefined method Illuminate\\Database\\Query\\Builder::edit()

Please help me or tell me why this error came up.

You try function update. In Illuminate\\Database\\Query\\Builder have function

/**
 * Update a record in the database.
 *
 * @param  array  $values
 * @return int
 */
public function update(array $values)
{
    $sql = $this->grammar->compileUpdate($this, $values);

    return $this->connection->update($sql, $this->cleanBindings(
        $this->grammar->prepareBindingsForUpdate($this->bindings, $values)
    ));
}

simple update method example:

Route('/update/profile/{id}','UserController@updateData');

public function updateData(Request $request){

   $value = ModelName::find($request->id);
   $value->name = $request->name;
   $value->email = $request->email;
   $value->nickaname = $request->nickaname;
   $value->save();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM