I am having a hard time trying to figure the error in the code. There some similar issues on SO, but they did not help that much with my specific problem. I also googled every possible phrases regarding the error, yet still no joy.
In ProductCategoryController.php I have:
namespace App\controllers\admin;
use App\classes\CSRFToken;
use App\classes\Request;
use App\classes\ValidateRequest;
use App\models\Category;
class ProductCategoryController
{
public $table_name = 'categories';
public $categories;
public $links;
public function __construct()
{
$obj = new Category();
$total = Category::all()->count(); // total number of rows
list($this->categories, $this->links) = paginate(3, $total, $this->table_name, $obj);
}
public function show() {
return view('admin/products/categories',
[
'categories' => $this->categories,
'links' => $this->links
]);
}
}
I get error
using $this when not in object context
on line 27 where I assign 'categories' => $this->categories and 'links' => $this->links
When I try setting 'categories' and 'links' to an empty array, everything work fine as expected.
In the RouteDispatcher.php I have:

Perhaps I may be missing something very obvious, any support with my problem is well appreciated.

ProductCategoryController::show()