App\Repositories\BaseRepository::update PHP Method

update() public method

public update ( Model $model, array $input ) : boolean
$model Illuminate\Database\Eloquent\Model
$input array
return boolean
    public function update(Model $model, array $input)
    {
        $updated = $model->update($input);
        if ($updated) {
            app('cache')->flush();
        }
        return $updated;
    }

Usage Example

 public function update(Request $request, $id)
 {
     $data = $request->all();
     if (!$this->repository->update($id, $data)) {
         return $this->response(405, "Validation Errors", $this->repository->getErrors(), 200);
     }
     return $this->success('Updated Successfully.', $this->repository->getStoredObject());
 }
All Usage Examples Of App\Repositories\BaseRepository::update