Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to a member function update() on null Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Call to a member function update() on null" Stacktrace: #0 Symfony\Component\Debug\Exception\FatalThrowableError in /mnt/www/africanexecutive.com/app/Http/Controllers/ArticleController.php:23
Application frames (1) All frames (1)
0
Symfony
\
Component
\
Debug
\
Exception
\
FatalThrowableError
/
app
/
Http
/
Controllers
/
ArticleController.php
23
/
mnt
/
www
/
africanexecutive.com
/
app
/
Http
/
Controllers
/
ArticleController.php
use App\Models\Subsection;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Models\Article;
use App\Models\Advertisement;
use App\Models\ArticleMap;
use Cache;

class ArticleController extends Controller
{
    public $cacheLife = 2400;
    
    function readArticle($articleID){
        
        $article = Article::find($articleID);

        # Increment views
        $article->update(['views'=>($article->views+1)]);
        
        $article = Cache::remember('article-'.$articleID, $this->cacheLife, function() use(&$articleID) {
            return Article::find($articleID);
        });

        # Get article section
        $section = Cache::remember('article-'.$articleID, $this->cacheLife, function() {
            return Subsection::find(ArticleMap::where(['article_id' => $article->id])->first()->section_id);
        });
        
        $related = Article::find(
                ArticleMap::select('article_id as id')->where('section_id', $section->id)->where('article_id', '!=', $section->id)->inRandomOrder()->take(7)->get()->toArray()
            );

        // dd($article->section);

        return view('article', [
            'article' => $article,
            'related' => $related,
            'section'=> $section,
Arguments
  1. "Call to a member function update() on null"
    

Environment & details:

empty
empty
empty
empty
empty
Key Value
USER
"www-data"
HOME
"/var/www"
HTTP_CF_CONNECTING_IP
"52.205.218.160"
HTTP_USER_AGENT
"claudebot"
HTTP_ACCEPT
"*/*"
HTTP_CF_VISITOR
"{"scheme":"https"}"
HTTP_X_FORWARDED_PROTO
"https"
HTTP_CF_RAY
"866a0f172b6381ac-FRA"
HTTP_X_FORWARDED_FOR
"52.205.218.160"
HTTP_ACCEPT_ENCODING
"gzip, br"
HTTP_CF_IPCOUNTRY
"US"
HTTP_CDN_LOOP
"cloudflare"
HTTP_HOST
"africanexecutive.com"
REDIRECT_STATUS
"200"
SERVER_NAME
"africanexecutive.com"
SERVER_PORT
"443"
SERVER_ADDR
"172.105.92.142"
REMOTE_PORT
"38030"
REMOTE_ADDR
"172.70.247.102"
SERVER_SOFTWARE
"nginx/1.18.0"
GATEWAY_INTERFACE
"CGI/1.1"
HTTPS
"on"
REQUEST_SCHEME
"https"
SERVER_PROTOCOL
"HTTP/2.0"
DOCUMENT_ROOT
"/mnt/www/africanexecutive.com/public"
DOCUMENT_URI
"/index.php"
REQUEST_URI
"/index.php/article/read/register"
CONTENT_LENGTH
""
CONTENT_TYPE
""
REQUEST_METHOD
"GET"
QUERY_STRING
""
SCRIPT_NAME
"/index.php"
SCRIPT_FILENAME
"/mnt/www/africanexecutive.com/public/index.php"
FCGI_ROLE
"RESPONDER"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1710815620.0656
REQUEST_TIME
1710815620
APP_ENV
"production"
APP_KEY
"base64:EXni4WSHZ64g4BvVb6esBZ0EySrURS0392jTpVEh/I0="
APP_DEBUG
"true"
APP_URL
"https://africanexecutive.com"
BROADCAST_DRIVER
"log"
CACHE_DRIVER
"file"
SESSION_DRIVER
"file"
QUEUE_DRIVER
"database"
REDIS_HOST
"127.0.0.1"
REDIS_PASSWORD
"null"
REDIS_PORT
"6379"
MAIL_DRIVER
"smtp"
MAIL_HOST
""
MAIL_PORT
"465"
MAIL_USERNAME
""
MAIL_PASSWORD
""
MAIL_ENCRYPTION
"null"
DB_CONNECTION
"mysql"
DB_HOST
"localhost"
DB_PORT
"3306"
DB_DATABASE
"africanexecutive.com"
DB_USERNAME
"root"
DB_PASSWORD
"ovxSk8PFpfkc4X9SKkC95YUBkj6mwW"
DEBUGBAR_ENABLED
"false"
REDIS_PASS
"7464578384894792349827392903490#!"
Key Value
APP_ENV
"production"
APP_KEY
"base64:EXni4WSHZ64g4BvVb6esBZ0EySrURS0392jTpVEh/I0="
APP_DEBUG
"true"
APP_URL
"https://africanexecutive.com"
BROADCAST_DRIVER
"log"
CACHE_DRIVER
"file"
SESSION_DRIVER
"file"
QUEUE_DRIVER
"database"
REDIS_HOST
"127.0.0.1"
REDIS_PASSWORD
"null"
REDIS_PORT
"6379"
MAIL_DRIVER
"smtp"
MAIL_HOST
""
MAIL_PORT
"465"
MAIL_USERNAME
""
MAIL_PASSWORD
""
MAIL_ENCRYPTION
"null"
DB_CONNECTION
"mysql"
DB_HOST
"localhost"
DB_PORT
"3306"
DB_DATABASE
"africanexecutive.com"
DB_USERNAME
"root"
DB_PASSWORD
"ovxSk8PFpfkc4X9SKkC95YUBkj6mwW"
DEBUGBAR_ENABLED
"false"
REDIS_PASS
"7464578384894792349827392903490#!"
0. Whoops\Handler\PrettyPageHandler