App\Http\Controllers\Admin\ActionController::updateSetting PHP Method

updateSetting() public method

public updateSetting ( )
    public function updateSetting()
    {
        @($name = \Input::get('name'));
        @($value = \Input::get('value'));
        $response = ['state' => 'error', 'message' => 'Something wrong.'];
        $check = \DB::table('setting')->where('name', $name)->first();
        if (count($check)) {
            try {
                \DB::table('setting')->where('name', $name)->update(['value' => $value]);
                $response = ['state' => 'success', 'message' => 'Update success.'];
            } catch (Exception $e) {
                $response = ['state' => 'failed', 'message' => 'Update failed.'];
            }
        }
        echo json_encode($response);
    }