Hi, Love your plugin, saved me so much time building a counter. I encountered a little problem while trying yo view the category page (http://localhost:90/blog/category/entertainment) Here'e the error I get: Please help! ERROR We're sorry, but an unhandled error occurred. Please see the details below.
Call to a member function getKey() on null C:\xampp\htdocs\yans-news\plugins\vdomah\blogviews\Plugin.php line 85
TYPE Undefined
EXCEPTION Symfony\Component\Debug\Exception\FatalThrowableError
79 80 81 82 83 84 85 86 87 88 89 90 91 }
if (!$slugValueFromUrl)
return;
$post = PostModel::where('slug', $slugValueFromUrl)->first();
$cookName = self::POST_VIEWED . $post->getKey();
if (!is_null($post) && Cookie::get( $cookName, 0 ) == 0) {
$this->setViews($post);
Cookie::queue( $cookName, '1', 525000 );
}
STACK TRACE
CALLED CODE DOCUMENT LINE
53 Vdomah\BlogViews\Plugin->Vdomah\BlogViews{closure}(…)
52 call_user_func(…) ~/vendor/october/rain/src/Extension/ExtendableTrait.php 60
51 October\Rain\Extension\Extendable->extendableConstruct() ~/vendor/october/rain/src/Extension/Extendable.php 31
50 October\Rain\Extension\Extendable->construct() ~/modules/cms/classes/ComponentBase.php 98
49 Cms\Classes\ComponentBase->construct(…)
48 ReflectionClass->newInstanceArgs(…) ~/vendor/october/rain/src/Foundation/Maker.php 85
47 October\Rain\Foundation\Maker->build(…) ~/vendor/october/rain/src/Foundation/Maker.php 41
46 October\Rain\Foundation\Maker->make(…) ~/vendor/october/rain/src/Foundation/Application.php 155
45 October\Rain\Foundation\Application->make(…) ~/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php 221
44 Illuminate\Support\Facades\Facade::__callStatic(…) ~/modules/cms/classes/ComponentManager.php 213
43 Cms\Classes\ComponentManager->makeComponent(…) ~/modules/cms/classes/Controller.php 1453
42 Cms\Classes\Controller->addComponent(…) ~/modules/cms/classes/Controller.php 660
41 Cms\Classes\Controller->initComponents() ~/modules/cms/classes/Controller.php 333
40 Cms\Classes\Controller->runPage(…) ~/modules/cms/classes/Controller.php 224
39 Cms\Classes\Controller->run(…) ~/modules/cms/classes/CmsController.php 50
38 Cms\Classes\CmsController->run(…)
37 call_user_func_array(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Controller.php 54
36 Illuminate\Routing\Controller->callAction(…) ~/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php 45
35 Illuminate\Routing\ControllerDispatcher->dispatch(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Route.php 212
34 Illuminate\Routing\Route->runController() ~/vendor/laravel/framework/src/Illuminate/Routing/Route.php 169
33 Illuminate\Routing\Route->run() ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 658
32 Illuminate\Routing\Router->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 30
31 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php 41
30 Illuminate\Routing\Middleware\SubstituteBindings->handle(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 149
29 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 53
28 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php 49
27 Illuminate\View\Middleware\ShareErrorsFromSession->handle(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 149
26 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 53
25 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php 63
24 Illuminate\Session\Middleware\StartSession->handle(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 149
23 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 53
22 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php 37
21 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 149
20 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 53
19 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php 66
18 Illuminate\Cookie\Middleware\EncryptCookies->handle(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 149
17 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 53
16 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 102
15 Illuminate\Pipeline\Pipeline->then(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 660
14 Illuminate\Routing\Router->runRouteWithinStack(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 635
13 Illuminate\Routing\Router->runRoute(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 601
12 Illuminate\Routing\Router->dispatchToRoute(…) ~/vendor/october/rain/src/Router/CoreRouter.php 20
11 October\Rain\Router\CoreRouter->dispatch(…) ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 176
10 Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 30
9 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php 46
8 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(…) ~/vendor/october/rain/src/Foundation/Http/Middleware/CheckForMaintenanceMode.php 24
7 October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 149
6 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php 53
5 Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(…) ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 102
4 Illuminate\Pipeline\Pipeline->then(…) ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 151
3 Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(…) ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 116
2 Illuminate\Foundation\Http\Kernel->handle(…) ~/index.php 43
1 require_once(…) ~/server.php 18
Last updated
Hello, I faced the same problem, when I implemented the Rainlab Translation plugin, after two days working around, I finally succeeded by replacing the line 85 by the code below:
if(is_null($post)){
return;
}else{
$cookName = self::POST_VIEWED . $post->getKey();
}
Last updated
robertmaku32322 said:
Hello, I faced the same problem, when I implemented the Rainlab Translation plugin, after two days working around, I finally succeeded by replacing the line 85 by the code below:
if(is_null($post)){ return; }else{ $cookName = self::POST_VIEWED . $post->getKey(); }
Thanks for the help, it worked. Can't imagine I didn't think of that as a solution.
1-4 of 4