By following steps:
https://discuss.flarum.org/d/23344-title-character-limit/8
I have this issue on v2:
2025/09/14 18:23:15 [error] 24671#24671: *5358 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Class "Flarum\Extend\Compat" not found in /var/www/flarum/extend.php:34
Could somebody please help with implementation example?
At this moment I'm using only this working modification in the extend.php:
<?php
use Flarum\Extend;
use Flarum\Foundation\AbstractServiceProvider;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class MyServiceProvider extends AbstractServiceProvider {
public function register () {
$this->container->make(ConfigRepository::class)->set('session.lifetime', 43829); // In minutes. Default is 120
}
}
return [
// Register extenders here to customize your forum!
(new Extend\ServiceProvider)
->register(MyServiceProvider::class),
];
The target:
Api/Resource/DiscussionResource.php
public function fields(): array
{
return [
Schema\Str::make('title')
->requiredOnCreate()
->writable(function (Discussion $discussion, Context $context) {
return $context->creating()
|| $context->getActor()->can('rename', $discussion);
})
->minLength(3)
->maxLength(80),