API_ACCOUNT_PREFIX
API_ACCOUNT_PREFIX
Accounts prefix.
includesMany(string $model, array $data) : \VivialConnect\Resources\Collection
Build a Collection of included resources in response payload.
string | $model | |
array | $data |
through(Resource|string $resource)
Set dependent resources to prepend to URI. You can call this method multiple times to prepend additional dependent resources.
For example, if the API only allows you create a new comment on a post through the post's URI: POST /posts/1234/comment
$comment = new Comment; $comment->through('posts/1234'); $comment->body = "This is a comment"; $comment->save();
OR
$post = Post::find(1234); $comment = new Comment; $comment->through($post); $comment->body = "This is a comment"; $comment->save();
Resource|string | $resource |
getConnection() : \VivialConnect\Transport\Connection
Get the connection for the model
find(integer|string|null $id = null, array $queryParams = array(), array $headers = array()) : Resource|boolean
Find (GET) a specific resource by its ID (optional)
This method assumes the payload contains a SINGLE resource instance. This method will call the parseFind method on the Resource instance to know where to look in the payload to get the resource data.
integer|string|null | $id | |
array | $queryParams | |
array | $headers |
all(array $queryParams = array(), array $headers = array()) : \VivialConnect\Resources\Collection|boolean
Get ALL resources
This method assumes the payload contains an ARRAY of resource instances. This method will call the parseAll method on the Resource instance to know where to look in the payload to get the array of resource data.
array | $queryParams | |
array | $headers |
findThrough(Resource|string $resource, integer|string|null $id = null, array $queryParams = array(), array $headers = array()) : Resource|boolean
Find a single instance *through* a dependent resource. It prepends the resource URI with the given dependent resource URI. For example: API URI: [GET] /posts/1234/comments/5678
$comment = Comment::findThrough('posts/1234', 5678);
OR
$post = Post::find(1234); $comment = Comment::findThrough($post, 5678);
Resource|string | $resource | |
integer|string|null | $id | |
array | $queryParams | |
array | $headers |
allThrough(Resource|string $resource, array $queryParams = array(), array $headers = array()) : \VivialConnect\Resources\Collection|boolean
Find all instances *through* a dependent resource. It prepends the resource URI with the given dependent resource URI. For example:
API URI: [GET] /posts/1234/comments
$comments = Comment::allThrough('posts/1234');
OR
$post = Post::find(1234); $comments = Comment::allThrough($post);
Resource|string | $resource | |
array | $queryParams | |
array | $headers |
connection() : \VivialConnect\Transport\Connection
Get the connection