| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace MGModule\DNSManager2\mgLibs\custom\dns\submodules\GoogleCloud;
- use \Illuminate\Database\Eloquent\model as EloquentModel;
- use \Illuminate\Database\Schema\Blueprint;
- use \WHMCS\Database\Capsule;
- /**
- * Description of TaskHistory
- *
- * @author Mateusz Pawłowski <mateusz.pa@modulesgarden.com>
- *
- *
- * @method public static WhereDomain(string $domain)
- * @method public static WhereName(string $name)
- *
- * @property int $id
- * @property int $hosting_id
- * @property string $task
- */
- class DomainRelations extends EloquentModel
- {
- /*
- * Table name
- *
- * @var string $table
- */
- protected $table = 'dns_manager2_googlecloud_domains';
- /**
- * Eloquent fillable parameters
- * @var array
- */
- protected $fillable = ['domain', 'name'];
- /*
- * Scope to get task where hosting ID
- *
- * @param integer $serviceID
- */
- public function scopeWhereDomain($query, $domain)
- {
- return $query->where('domain', $domain);
- }
- public function scopeWhereName($query, $name)
- {
- return $query->where('name', $name);
- }
- //////////////////////////// Create Table //////////////////////////////////////
- /*
- * Check table exist
- *
- * @return boolean
- */
- public function tableExists()
- {
- return Capsule::Schema()->hasTable($this->table);
- }
- /*
- * Create table
- *
- * @return void
- */
- protected function createTable()
- {
- Capsule::schema()->create($this->table, function (Blueprint $table)
- {
- $table->charset = 'utf8';
- $table->collation = 'utf8_general_ci';
- $table->increments('id')->unique();
- $table->string('domain', 255);
- $table->string('name', 255);
- $table->timestamps();
- });
- }
- /*
- * Check and create if not exist
- *
- * @return void
- */
- public function createTableIfNotExists()
- {
- if (!$this->tableExists())
- {
- $this->createTable();
- }
- }
- }
|