Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
evsmash/widgets / libs / Schemas / Ratings.php
Size: Mime:
<?php 

namespace Evsmash\Widgets\Schemas;

use Evsmash\Core\Schemas\Base;

class Ratings extends Base {

	protected $table = 'ratings';

	// validate
	static public function validate() {

		return [
			'rel' => 'req|max:50',
			'ip' => 'max:15',
			'rate' => 'int',
			'user_id' => 'int', 
			'smash_id' => 'max:30'
		];

	}

	// create
	public function create() {

		if(cfg('evsmash-widgets-ratings')) {

			$this->schemaCreate(function($m) {
				$m->increments('id');
				$m->string('rel', 50);
				$m->string('ip', 15);
				$m->tinyInteger('rate');
				$m->nullabletimestamps();
				$m->softDeletes();
				$m->integer('user_id');
				$m->string('smash_id', 30);
			});

		}

	}

	// rebuild 1
	public function rebuild_12() {

		$this->schemaIndexAdd('rel');
		$this->schemaIndexAdd('user_id');
		$this->schemaIndexAdd('smash_id');

	}

}