Git Product home page Git Product logo

serverpilot-api's People

Contributors

colintucker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cargie devuri

serverpilot-api's Issues

Array to string conversion error

I'm trying to creat an app and keep receiving the following error

Array to string conversion

I'm just trying to do something real basic and it won't let me.

$sp = ServerPilotAPI::inst('MYCID', 'MYKEY');

$app = $sp->apps->create('shemphoward', 'I0F3Gn9GBsVl9YOs', 'php7.0', ['shemphoward.com']);

Tried it like this too. No luck

$app = $sp->apps->create('shemphoward', 'I0F3Gn9GBsVl9YOs', 'php7.0', 'shemphoward.com');

Trying to get server ID for a dropdown menu

I'm using Laravel, and am creating a dropdown menu so customers can select their server when creating new apps. I want the menu to be real simple, something like:

<select name="server_id">
    <option value="{{ SERVER_ID }}">{{ SERVER NAME }}</option>
</select>

Here's the code I'm using to build the array

<?php

namespace App;

use ServerPilot\ServerPilotAPI;
use Illuminate\Database\Eloquent\Model;

class ServerPilot extends Model
{
    public static function listServers($option = null)
    {
        $sp = ServerPilotAPI::inst('MY_ID', 'MY_KEY');
        $servers = $sp->servers->listAll();

        if($option == 'dropdown') {

            $array = [];

            foreach($servers as $server) {
                dd($server->id); // just trying to see the value...
                $array[$value->id] = $value->name;
            }

            return $array;
        }

        return $servers;
    }
}

However, when running that code I receive the following error

Cannot access protected property ServerPilot\Model\Server::$id

How can I retrieve the ID and name of the servers without having to do a lookup for each during the loop?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.