Components\ContactManager\Controllers\Backend\ContactController::update PHP Метод

update() публичный Метод

Update the specified resource in storage.
public update ( integer $id ) : Illuminate\Http\RedirectResponse
$id integer
Результат Illuminate\Http\RedirectResponse
    public function update($id)
    {
        $input = Input::all();
        if (isset($input['form_close'])) {
            return Redirect::to("{$this->link}contact-manager");
        }
        if (isset($input['form_save'])) {
            $redirect = "{$this->link}contact-manager";
        } else {
            $redirect = "{$this->link}contact-manager/create/{$input['form_id']}";
        }
        $input['location'] = json_encode(array('latitude' => $input['location-lat'], 'longitude' => $input['location-lon']));
        $display_options = $this->getDisplayOptions($input);
        $input['display_options'] = json_encode($display_options);
        $form = $this->getForm($input['form_id']);
        try {
            App::make('Components\\ContactManager\\Validation\\ContactValidator')->validateForCreation($input);
            $model_name = "Components\\ContactManager\\Models\\{$form['model']}";
            $entry = $model_name::find($id)->update($input);
        } catch (ValidationException $e) {
            return Redirect::back()->withInput()->withErrors($e->getErrors());
        }
        return Redirect::to($redirect)->with('success_message', trans('success_messages.contact_update'));
    }