Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a single Droplet? #16

Closed
dotmbf opened this issue Jun 27, 2017 · 2 comments
Closed

Getting a single Droplet? #16

dotmbf opened this issue Jun 27, 2017 · 2 comments

Comments

@dotmbf
Copy link

dotmbf commented Jun 27, 2017

Isn't there a method for getting just a single droplet for the specific ID?
Like:

    public function power($droplet_id) {

        dd(DigitalOcean::droplet($droplet_id));
        return redirect()->back();
    }
@GrahamCampbell
Copy link
Owner

Yes DigitalOcean::droplet()->getById($droplet_id) will return a droplet entity.

See https://github.com/toin0u/DigitalOceanV2/blob/master/src/Api/Droplet.php#L102 and https://github.com/toin0u/DigitalOceanV2/blob/master/src/Entity/Droplet.php.

@dotmbf
Copy link
Author

dotmbf commented Jun 27, 2017

Thanks! Way better than

private function droplet($id) {
    foreach (DigitalOcean::droplet()->getAll() as $droplet) {
        if ($droplet->id == $id) {
            return $droplet;
        }
    }

    return null;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants