Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to a member function products() on null Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Call to a member function products() on null" Stacktrace: #0 Symfony\Component\Debug\Exception\FatalThrowableError in /home/pepecust/public_html/themostsearched.com/project/app/Http/Controllers/FrontendController.php:166
Application frames (1) All frames (1)
0
Symfony
\
Component
\
Debug
\
Exception
\
FatalThrowableError
/
app
/
Http
/
Controllers
/
FrontendController.php
166
/
home
/
pepecust
/
public_html
/
themostsearched.com
/
project
/
app
/
Http
/
Controllers
/
FrontendController.php
 
 
    public function lang($id)
    {
        Session::put('language', $id);
        return redirect()->back();
    }
 
 
    public function currency($id)
    {
        Session::put('currency', $id);
        return redirect()->back();
    }
 
    public function category(Request $request,$slug)
    {
        $sort = "";
        $cat = Category::where('cat_slug','=',$slug)->first();
        $cats = $cat->products()->where('status','=',1)->orderBy('id','desc')->paginate(9);
        if(!empty($request->min) || !empty($request->max))
        {
        $min = $request->min;
        $max = $request->max;
        $cats = $cat->products()->where('status','=',1)->whereBetween('cprice', [$min, $max])->orderBy('cprice','asc')->paginate(9);
        return view('front.category',compact('cat','cats','sort','min','max'));
        }
        return view('front.category',compact('cat','sort','cats'));
    }
 
    public function categorysort($slug,$sorted)
    {
        $sort = $sorted;
        $cat = Category::where('cat_slug','=',$slug)->first();
        if($sort == "new")
        {
        $cats = $cat->products()->where('status','=',1)->orderBy('id','desc')->paginate(9);
        }
        else if($sort == "old")
        {
Arguments
  1. "Call to a member function products() on null"
    

Environment & details:

empty
empty
empty
empty
empty
Key Value
CONTEXT_DOCUMENT_ROOT
"/home/pepecust/public_html/themostsearched.com"
CONTEXT_PREFIX
""
DOCUMENT_ROOT
"/home/pepecust/public_html/themostsearched.com"
GATEWAY_INTERFACE
"CGI/1.1"
HTTPS
"on"
HTTP_ACCEPT
"*/*"
HTTP_HOST
"themostsearched.com"
HTTP_REFERER
"https://themostsearched.com/category/electronics/"
HTTP_USER_AGENT
"claudebot"
HTTP_X_HTTPS
"1"
PATH
"/bin:/usr/bin"
PHP_INI_SCAN_DIR
"/opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:."
QUERY_STRING
""
REDIRECT_HTTPS
"on"
REDIRECT_SCRIPT_URI
"https://themostsearched.com/category/electronics"
REDIRECT_SCRIPT_URL
"/category/electronics"
REDIRECT_SSL_TLS_SNI
"themostsearched.com"
REDIRECT_STATUS
"200"
REDIRECT_UNIQUE_ID
"ZgXzQj3qAnHT9vEUTP65RwAAAFA"
REDIRECT_URL
"/category/electronics"
REMOTE_ADDR
"3.88.16.192"
REMOTE_PORT
"59014"
REQUEST_METHOD
"GET"
REQUEST_SCHEME
"https"
REQUEST_URI
"/category/electronics"
SCRIPT_FILENAME
"/home/pepecust/public_html/themostsearched.com/index.php"
SCRIPT_NAME
"/index.php"
SCRIPT_URI
"https://themostsearched.com/category/electronics"
SCRIPT_URL
"/category/electronics"
SERVER_ADDR
"185.221.216.105"
SERVER_ADMIN
"webmaster@themostsearched.com.pepecustom.com"
SERVER_NAME
"themostsearched.com"
SERVER_PORT
"443"
SERVER_PROTOCOL
"HTTP/1.1"
SERVER_SIGNATURE
""
SERVER_SOFTWARE
"Apache"
SSL_TLS_SNI
"themostsearched.com"
TZ
"UTC"
UNIQUE_ID
"ZgXzQj3qAnHT9vEUTP65RwAAAFA"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1711665986.7313
REQUEST_TIME
1711665986
argv
[]
argc
0
APP_NAME
"Laravel"
APP_ENV
"local"
APP_KEY
"base64:X7O+zKNquMPDIHIBGNItbOcjz9VWnf/4kst5fwdcuFg="
APP_DEBUG
"true"
APP_LOG_LEVEL
"debug"
APP_URL
"http://localhost"
DB_CONNECTION
"mysql"
DB_HOST
"127.0.0.1"
DB_PORT
"3306"
DB_DATABASE
"pepecust_mostsearch"
DB_USERNAME
"pepecust_mostsearch"
DB_PASSWORD
"###King###1975###"
BROADCAST_DRIVER
"log"
CACHE_DRIVER
"file"
SESSION_DRIVER
"file"
SESSION_LIFETIME
"120"
QUEUE_DRIVER
"sync"
REDIS_HOST
"127.0.0.1"
REDIS_PASSWORD
"null"
REDIS_PORT
"6379"
MAIL_DRIVER
"smtp"
MAIL_HOST
"smtp.mailtrap.io"
MAIL_PORT
"2525"
MAIL_USERNAME
"null"
MAIL_PASSWORD
"null"
MAIL_ENCRYPTION
"null"
PUSHER_APP_ID
""
PUSHER_APP_KEY
""
PUSHER_APP_SECRET
""
PUSHER_APP_CLUSTER
"mt1"
Key Value
APP_NAME
"Laravel"
APP_ENV
"local"
APP_KEY
"base64:X7O+zKNquMPDIHIBGNItbOcjz9VWnf/4kst5fwdcuFg="
APP_DEBUG
"true"
APP_LOG_LEVEL
"debug"
APP_URL
"http://localhost"
DB_CONNECTION
"mysql"
DB_HOST
"127.0.0.1"
DB_PORT
"3306"
DB_DATABASE
"pepecust_mostsearch"
DB_USERNAME
"pepecust_mostsearch"
DB_PASSWORD
"###King###1975###"
BROADCAST_DRIVER
"log"
CACHE_DRIVER
"file"
SESSION_DRIVER
"file"
SESSION_LIFETIME
"120"
QUEUE_DRIVER
"sync"
REDIS_HOST
"127.0.0.1"
REDIS_PASSWORD
"null"
REDIS_PORT
"6379"
MAIL_DRIVER
"smtp"
MAIL_HOST
"smtp.mailtrap.io"
MAIL_PORT
"2525"
MAIL_USERNAME
"null"
MAIL_PASSWORD
"null"
MAIL_ENCRYPTION
"null"
PUSHER_APP_ID
""
PUSHER_APP_KEY
""
PUSHER_APP_SECRET
""
PUSHER_APP_CLUSTER
"mt1"
0. Whoops\Handler\PrettyPageHandler