Repository URL to install this package:
|
Version:
3.2.0 ▾
|
<?php
namespace Evsmash\Items;
use Evsmash\Core\Database\Eloquent;
use Evsmash\Core\Database\SoftDeleting;
use Evsmash\Core\Simpy\Params;
use Evsmash\Items\Schemas\ItemsTypes as Schema;
class ItemsType extends Eloquent {
use SoftDeleting;
// validate
static public function validate() {
return Schema::validate();
}
// has many items
public function items() {
return $this->hasMany('Evsmash\Items\Item', 'type_id');
}
// params
public function scopeParams($query, $params = false) {
$scope = new Params();
$scope->scope($query, $params);
$scope->search(['name']);
$scope->order(['name' => 'ASC']);
return $scope->query;
}
}