Repository URL to install this package:
|
Version:
3.3.1 ▾
|
<?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');
}
}