12345678910111213141516171819202122 |
- <?php
- namespace app\models;
- use app\helpers\Transliterator;
- use yii\helpers\Inflector;
- /**
- * @property string $url
- */
- class News extends \app\models\base\News
- {
- public function getUrl():string
- {
- if(count($this->topics)>0){
- $topic = Transliterator::toUrl($this->topics[0]->title)."/";
- } else{
- $topic = "";
- }
- return "/news/".$topic.Transliterator::toUrl($this->title)."-".$this->id;
- }
- }
|