Skip to content

Commit

Permalink
Merge pull request #24 from sleiman/checkSingle
Browse files Browse the repository at this point in the history
added quick record count
  • Loading branch information
sleiman committed Oct 18, 2018
2 parents 35e5a6f + aaf68e5 commit b90efef
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Airtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,29 @@ function deleteContent($content_type)

}

function deleteContent($content_type)
{

$request = new Request( $this, $content_type, [], 'delete' );

return $request->getResponse();

}

function countRecords($content_type,$field="",$value="",$relations=false)
{
$params = "";
if (!empty($field)&& !empty($value)){

$params = array(
"filterByFormula" => "AND({{$field}} = '$value')",
);
}

$request = new Request( $this, $content_type, $params, false, $relations );
$response = $request->getResponse();
$records = $response->records;
return count($records);
}

}

0 comments on commit b90efef

Please sign in to comment.