code: protected function checkFieldsSet($fields)
      {
          foreach ($fields as $field) {
              if (property_exists($this, $field) && $this->$field === null) {
                  throw new \Exception("'$field' is required");
              }
  
          }
  
      }
docs: Checks if the fields given are all assigned
  @param $fields
  @throws \Exception