type = $type ?? $this->type; switch ($this->type){ case "jpg": return "https://green.amic.ru/images/news/news/{$this->post_id}_size{$size}.jpg"; break; default: return "https://green.amic.ru/images/news/webp/{$this->post_id}_size{$size}.webp"; } return ($full?"https://api.amic.ru":"")."/uploads/news/images/".$this->file_name; } public static function find(){ $model = new static(); return $model; } public static function findOne($id,$type="webp"){ $model = self::find(); $model->type = $type; $model->post_id = $id; return $model; } }