* * * @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(); } } }