server {
listen 80 default_server;
server_name notice.com;
set $base_root /var/www/notice.com;
root $base_root;
charset UTF-8;
index index.php index.html;
location / {
root $base_root/frontend/web;
try_files $uri $uri/ /frontend/web/index.php$is_args$args;
location ~ ^/assets/.+\.php(/|$) {
deny all;
}
}
location /admin {
alias $base_root/backend/web/;
try_files $uri /backend/web/index.php$is_args$args;
location ~ ^/admin/assets/.+\.php(/|$) {
deny all;
}
}
location ~ ^/.+\.php(/|$) {
rewrite (?!^/((frontend|backend)/web|admin))^ /frontend/web$uri break;
rewrite (?!^/backend/web)^/admin(/.+)$ /backend/web$1 break;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\. {
deny all;
}
}
[['image'], 'required'],
['image', 'file', 'extensions' => ['mp3']],
'visibleButtons' = [
'update' => Yii::$app->user->can('updateOwnPost')
'delete' => Yii::$app->user->can('updateOwnPost')
]
echo count($model->topics->messages);
public function getTopicMessagesCount() {
return $this->getTopicMessages()->count();
}