Why isn't my controller returning AccessResult::forbidden()? I'm working on a node access module. I've set up my logic. I can't seem to get my code to return AccessResult::forbidden(). I can't even get \dpm to run in access method. What am I doing wrong? Below are my routing.yml and controller.

/* nodeaccess.routing.yml */
nodeaccess.people:
  path: '/user/{uid}/edit'
  defaults:
    _controller: '\Drupal\nodeaccess\Controller\NodeaccessController::content'
    _title: 'Dashboard'
  requirements:
    _custom_access: '\Drupal\nodeaccess\Controller\NodeaccessController::access'

/* src/Controller/NodeAccessController.php */

&lt;?php

namespace Drupal\nodeaccess\Controller;

use Drupal\Core\Access\AccessResult; 
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Session\AccountInterface;

/**
 * Defines the Dashboard controller.
 */
class NodeaccessController extends ControllerBase {

 /**
  * Returns content for this controller.
  */
 public function content() {
   $today = date("l");
   if ($today == "Thursday") {
     // Return 403 Access Denied page.  
     \dpm("You are not allowed.");
   }
 }

 /**
  * Checks access for this controller.
  */
 public function access(AccountInterface $account) {
  $current_user = User::load(Drupal::currentUser()-&gt;id());
  $user = User::load(explode("/", $_SERVER["REQUEST_URI"])[1]);
  if ($current_user-&gt;field_department-&gt;target_id != $user-&gt;field_department-&gt;target_id) {
    return AccessResult::forbidden();
  }
  return AccessResult::allowed();
  }
}
There is a syntax error here Drupal::currentUser()-&gt;id() should be \Drupal::currentUser()-&gt;id() and also explode("/", $_SERVER["REQUEST_URI"])[2] gives you only people not the user id, to use User::load.