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/items / libs / ItemsType.php
Size: Mime:
<?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;

	}

}