clarkwinkelmann llaumgui can you share the output of php flarum info so we can check your Flarum version and the version of this extension
./flarum info [master ✘]
Flarum core 0.1.0-beta.16
PHP version: 7.4.16
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, readline, Reflection, SPL, session, standard, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, intl, json, exif, mysqlnd, PDO, Phar, posix, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, mysqli, pdo_mysql, pdo_sqlite, xmlreader, imagick, pcov, zip, xdebug
+---------------------------------+------------------+--------+
| Flarum Extensions | | |
+---------------------------------+------------------+--------+
| ID | Version | Commit |
+---------------------------------+------------------+--------+
| flarum-flags | v0.1.0-beta.16 | |
| flarum-subscriptions | v0.1.0-beta.16 | |
| flarum-tags | v0.1.0-beta.16 | |
| fof-disposable-emails | 0.3.0 | |
| fof-profile-image-crop | 0.3.0 | |
| fedora-fr-fedora-fr-theme | dev-master | |
| fof-spamblock | 0.5.0 | |
| fof-polls | 0.4.1 | |
| rooaaar-lang-french-extended | v1.18.0 | |
| qiaeru-lang-french | v1.10.0 | |
| fof-user-bio | 0.5.0 | |
| fof-socialprofile | 0.3.0 | |
| fof-prevent-necrobumping | 0.5.0 | |
| fof-nightmode | 0.8.0 | |
| fof-links | 0.6.0 | |
| fof-formatting | 0.4.0 | |
| fof-drafts | 0.4.0 | |
| fof-best-answer | 0.4.0 | |
| migratetoflarum-old-passwords | 0.6.0 | |
| flarum-approval | v0.1.0-beta.16 | |
| flarum-emoji | v0.1.0-beta.16 | |
| flarum-likes | v0.1.0-beta.16 | |
| flarum-lock | v0.1.0-beta.16 | |
| flarum-markdown | v0.1.0-beta.16.1 | |
| flarum-mentions | v0.1.0-beta.16 | |
| flarum-statistics | v0.1.0-beta.16 | |
| flarum-sticky | v0.1.0-beta.16 | |
| flarum-suspend | v0.1.0-beta.16 | |
| flarum-nicknames | 0.1.0-beta.16.1 | |
| fof-default-user-preferences | 0.4.0 | |
| fof-follow-tags | 0.7.2 | |
| fof-forum-statistics-widget | 0.6.0 | |
| fof-merge-discussions | 0.5.1 | |
| fof-pwned-passwords | 0.7.0 | |
| fof-realtimedate | 0.3.0 | |
| fof-split | 0.7.0 | |
| fof-user-directory | 0.6.1 | |
| fof-sitemap | 0.7.0 | |
| fof-username-request | 0.5.0 | |
| michaelbelgium-discussion-views | v6.0.0 | |
| flarum-bbcode | v0.1.0-beta.16 | |
| v17development-seo | v1.7.2 | |
+---------------------------------+------------------+--------+
Base URL: http://flarum.fedora-fr.localhost
Installation path: /home/llaumgui/public_html/flarum
Debug mode: ON
Don't forget to turn off debug mode! It should never be turned on in a production system.
Looking at the source code of the extension, the code for the relationship appears to be there and should be compatible with the latest Flarum. I have not tested the extension recently however.
relationship seem to be here:
const RELATIONSHIP = "profileViews"; //$user->profileViews()
const RELATIONSHIP_LATEST = "latestProfileViews";
$settings = app(SettingsRepositoryInterface::class);
return [
(new Frontend('forum'))
->js(__DIR__. '/js/dist/forum.js')
->css(__DIR__. '/less/extension.less'),
(new Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
new Locales(__DIR__ . '/locale'),
(new Routes('api'))
->post('/profileview', 'profileview.create', CreateUserProfileViewController::class),
(new Model(User::class))->relationship(RELATIONSHIP, function(AbstractModel $model) {
return $model->hasMany(UserProfileView::class, 'viewed_user_id')->orderBy('visited_at', 'DESC');
})->relationship(RELATIONSHIP_LATEST, function (AbstractModel $model) use ($settings) {
return $model->{RELATIONSHIP}()->limit($settings->get('michaelbelgium-profileviews.max_listcount'));
}),
(new ApiSerializer(UserSerializer::class))
->hasMany(RELATIONSHIP, UserProfileViewSerializer::class)
->hasMany(RELATIONSHIP_LATEST, UserProfileViewSerializer::class),
(new ApiController(ShowUserController::class))
//".x" comes from model relationship UserProfileView
->addInclude([RELATIONSHIP, RELATIONSHIP_LATEST, RELATIONSHIP_LATEST.'.viewer', RELATIONSHIP_LATEST.'.viewedUser']),
];
EDIT: I now notice that in the error message, the latestProfileViews relationship appears to be queried on a discussion instead of a user. Are you able to share the full backtrace from the log file so we can see which part of the code this originates from?
Illuminate\Database\Eloquent\RelationNotFoundException thrown with message "Call to undefined relationship [latestProfileViews] on model [Flarum\Discussion\Discussion]."
Stacktrace:
#61 Illuminate\Database\Eloquent\RelationNotFoundException in /var/www/flarum/vendor/illuminate/database/Eloquent/RelationNotFoundException.php:34
#60 Illuminate\Database\Eloquent\RelationNotFoundException:make in /var/www/flarum/vendor/illuminate/database/Eloquent/Builder.php:655
#59 Illuminate\Database\Eloquent\Builder:Illuminate\Database\Eloquent\{closure} in /var/www/flarum/vendor/illuminate/database/Eloquent/Relations/Relation.php:99
#58 Illuminate\Database\Eloquent\Relations\Relation:noConstraints in /var/www/flarum/vendor/illuminate/database/Eloquent/Builder.php:657
#57 Illuminate\Database\Eloquent\Builder:getRelation in /var/www/flarum/vendor/illuminate/database/Eloquent/Builder.php:625
#56 Illuminate\Database\Eloquent\Builder:eagerLoadRelation in /var/www/flarum/vendor/illuminate/database/Eloquent/Builder.php:605
#55 Illuminate\Database\Eloquent\Builder:eagerLoadRelations in /var/www/flarum/vendor/illuminate/database/Eloquent/Model.php:506
#54 Illuminate\Database\Eloquent\Model:load in /var/www/flarum/vendor/flarum/core/src/Api/Controller/ShowDiscussionController.php:102
#53 Flarum\Api\Controller\ShowDiscussionController:data in /var/www/flarum/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php:102
#52 Flarum\Api\Controller\AbstractSerializeController:handle in /var/www/flarum/vendor/flarum/core/src/Api/Client.php:72
#51 Flarum\Api\Client:send in /var/www/flarum/vendor/flarum/core/src/Forum/Content/Discussion.php:108
#50 Flarum\Forum\Content\Discussion:getApiDocument in /var/www/flarum/vendor/flarum/core/src/Forum/Content/Discussion.php:64
#49 Flarum\Forum\Content\Discussion:__invoke in /var/www/flarum/vendor/flarum/core/src/Frontend/Frontend.php:63
#48 Flarum\Frontend\Frontend:populate in /var/www/flarum/vendor/flarum/core/src/Frontend/Frontend.php:55
#47 Flarum\Frontend\Frontend:document in /var/www/flarum/vendor/flarum/core/src/Frontend/Controller.php:32
#46 Flarum\Frontend\Controller:handle in /var/www/flarum/vendor/flarum/core/src/Http/RouteHandlerFactory.php:38
#45 Flarum\Http\RouteHandlerFactory:Flarum\Http\{closure} in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php:27
#44 Flarum\Http\Middleware\ExecuteRoute:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#43 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/fof/pwned-passwords/src/Middleware/CheckPasswordReset.php:64
#42 FoF\PwnedPasswords\Middleware\CheckPasswordReset:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#41 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/fof/pwned-passwords/src/Middleware/CheckLoginPassword.php:53
#40 FoF\PwnedPasswords\Middleware\CheckLoginPassword:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#39 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/fof/pwned-passwords/src/Middleware/PreventPwnedPassword.php:71
#38 FoF\PwnedPasswords\Middleware\PreventPwnedPassword:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#37 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/FlarumPromotionHeader.php:29
#36 Flarum\Http\Middleware\FlarumPromotionHeader:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#35 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ShareErrorsFromSession.php:57
#34 Flarum\Http\Middleware\ShareErrorsFromSession:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#33 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php:36
#32 Flarum\Http\Middleware\CheckCsrfToken:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#31 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php:67
#30 Flarum\Http\Middleware\ResolveRoute:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#29 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/SetLocale.php:50
#28 Flarum\Http\Middleware\SetLocale:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#27 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php:32
#26 Flarum\Http\Middleware\AuthenticateWithSession:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#25 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php:52
#24 Flarum\Http\Middleware\RememberFromCookie:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#23 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/StartSession.php:61
#22 Flarum\Http\Middleware\StartSession:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#21 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/CollectGarbage.php:46
#20 Flarum\Http\Middleware\CollectGarbage:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#19 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php:28
#18 Flarum\Http\Middleware\ParseJsonBody:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#17 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php:57
#16 Flarum\Http\Middleware\HandleErrors:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#15 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:84
#14 Laminas\Stratigility\MiddlewarePipe:process in /var/www/flarum/vendor/middlewares/request-handler/src/RequestHandler.php:84
#13 Middlewares\RequestHandler:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#12 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/middlewares/base-path-router/src/BasePathRouter.php:101
#11 Middlewares\BasePathRouter:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#10 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php:42
#9 Laminas\Stratigility\Middleware\OriginalMessages:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#8 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/middlewares/base-path/src/BasePath.php:73
#7 Middlewares\BasePath:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#6 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/flarum/core/src/Http/Middleware/ProcessIp.php:24
#5 Flarum\Http\Middleware\ProcessIp:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/Next.php:61
#4 Laminas\Stratigility\Next:handle in /var/www/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:84
#3 Laminas\Stratigility\MiddlewarePipe:process in /var/www/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:73
#2 Laminas\Stratigility\MiddlewarePipe:handle in /var/www/flarum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php:96
#1 Laminas\HttpHandlerRunner\RequestHandlerRunner:run in /var/www/flarum/vendor/flarum/core/src/Http/Server.php:44
#0 Flarum\Http\Server:listen in /var/www/flarum/public/index.php:26