Repository URL to install this package:
|
Version:
3.4.1 ▾
|
<?php
namespace Evsmash\News;
use Evsmash\Core\Database\Eloquent;
use Evsmash\Core\Database\SoftDeleting;
use Evsmash\Core\Simpy\Params;
use Evsmash\News\Schemas\NewsTypes as Schema;
class NewsType extends Eloquent {
use SoftDeleting;
// validate
static public function validate() {
return Schema::validate();
}
// has many news
public function news() {
return $this->hasMany('Evsmash\News\News', '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;
}
}