Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined function RainLab\Blog\Models\optional() in C:\OSPanel535\domains\october.local\plugins\rainlab\blog\models\Category.php:67
public function getPostCountAttribute()
{
return optional($this->posts_count->first())->count ?? 0;
}
@HugoBossOD Which PHP version are you running? Also, have you installed all of October CMS's dependencies?
CMS installed with composer.
Plugin installed with backend.
PHP 7.1.32
All needed PHP extensions enabled
Problem appears when accessing Blog Categories page in backend.
Tried to search code for 'optional('. Only mentioned in 'faker' files.
Now changed string to public function getPostCountAttribute() { return $this->posts_count->first()->count ?? 0; } and all seems working fine.
@HugoBossOD which version of October are you running?
The optional method is one provided by Laravel, however, it was not in Laravel 5.1 which October was based on before build 420.
october/backend v1.0.419
october/cms v1.0.419
october/rain v1.0.419
october/system v1.0.419
laravel/framework v5.1.46
Version problems. Thanks for pointing.
Most helpful comment
october/backend v1.0.419
october/cms v1.0.419
october/rain v1.0.419
october/system v1.0.419
laravel/framework v5.1.46
Version problems. Thanks for pointing.