How to run Eloquent standalone
EloquentSteps:
composer require illuminate/database lang-bash
Example code:
<?php use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'whmcs', 'username' => 'whmcs', 'password' => 'password', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ]); $capsule->setAsGlobal(); $capsule->bootEloquent(); $client = [ 'database_name' => 'whmcs', 'database_username' => 'whmcs', 'database_password' => 'password', ]; $whmcs = new \Eugenefvdm\Api\Whmcs($client); $whmcs->createCustomClientField('test'); lang-php
Model (WHMCS likes empty fields):
<?php namespace Eugenefvdm\Api\Models; use Illuminate\Database\Eloquent\Model; class CustomField extends Model { protected $table = 'tblcustomfields'; protected $fillable = [ 'type', 'fieldname', 'fieldtype', 'description', 'fieldoptions', 'regexpr', 'adminonly', 'required', 'showorder', 'showinvoice', ]; protected $attributes = [ 'description' => '', 'fieldoptions' => '', 'regexpr' => '', 'adminonly' => '', 'required' => '', 'showorder' => '', 'showinvoice' => '', ]; } lang-php