Backend\Classes\BackendController

Overview

BackendController is the master controller for all back-end pages. All requests that are prefixed with the backend URI pattern are sent here, then the next URI segments are analyzed and the request is routed to the relevant back-end controller.

For example, a request with the URL /backend/acme/blog/posts will look for the Posts controller inside the Acme.Blog plugin.

Extends
  • Illuminate\Routing\Controller
See Also

Public Properties

public array $implement

Behaviors implemented by this controller.

public static string $action

Allows early access to page action.

public static array $params

Allows early access to page parameters.

Protected Properties

protected array $extensionData

extensionData contains class reflection information, including behaviors

protected static array $extendableStaticMethods

extendableStaticMethods is a collection of static methods used by behaviors

protected static bool $extendableGuardProperties

extendableGuardProperties indicates if dynamic properties can be created

Show inherited protected properties

Inherited Protected Properties

  • $middleware - The middleware registered on the controller. (defined in Illuminate\Routing\Controller)

Public Methods

public __construct()

public __construct(): void

__construct a new BackendController instance

public addDynamicMethod()

public addDynamicMethod(
    string $dynamicName,
    callable $method,
    string $extension = null
): void

addDynamicMethod programmatically adds a method to the extendable class

public addDynamicProperty()

public addDynamicProperty(string $dynamicName, string $value = null): void

addDynamicProperty programmatically adds a property to the extendable class

public asExtension()

public asExtension(string $shortName): mixed 

asExtension is short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

public static clearExtendedClasses()

public static clearExtendedClasses(): void

public static extend()

public static extend($callback): void

extend this object properties upon construction

public extendClassWith()

public extendClassWith(string $extensionName): void 

extendClassWith dynamically extends a class with a specified behavior

public extendableCall()

public extendableCall(string $name, array $params = null): mixed 

extendableCall magic method for __call()

public static extendableCallStatic()

public static extendableCallStatic(
    string $name,
    array $params = null
): mixed 

extendableCallStatic magic method for __callStatic()

public extendableConstruct()

public extendableConstruct(): void

extendableConstruct should be called as part of the constructor

public extendableDestruct()

public extendableDestruct(): void

extendableDestruct should be called when serializing the object

public static extendableExtendCallback()

public static extendableExtendCallback(callable $callback): void 

extendableExtendCallback is a helper method for ::extend() static method

public extendableGet()

public extendableGet(string $name): string 

extendableGet magic method for __get()

public extendableSet()

public extendableSet(string $name, string $value): string 

extendableSet magic method for __set()

public getClassExtension()

public getClassExtension(string $name): mixed 

getClassExtension returns a behavior object from an extendable class, example:

$this->getClassExtension('Backend.Behaviors.FormController')

public getClassMethodAsReflector()

public getClassMethodAsReflector($name): ReflectionFunctionAbstract 

public getClassMethods()

public getClassMethods(): array 

getClassMethods gets a list of class methods, extension equivalent of get_class_methods()

public getDynamicProperties()

public getDynamicProperties(): array 

getDynamicProperties returns all dynamic properties and their values

public implementClassWith()

public implementClassWith($extensionName): void

implementClassWith will implement an extension using non-interference and should be used with the static extend() method.

public isClassExtendedWith()

public isClassExtendedWith(string $name): boolean 

isClassExtendedWith checks if extendable class is extended with a behavior object

public isClassInstanceOf()

public isClassInstanceOf($interface): bool 

isClassInstanceOf checks if the class implements the supplied interface methods.

public methodExists()

public methodExists(string $name): boolean 

methodExists checks if a method exists, extension equivalent of method_exists()

public propertyExists()

public propertyExists(string $name): boolean 

propertyExists checks if a property exists, extension equivalent of property_exists()

public run()

public run(string $url = null): string 

run finds and serves the requested backend controller If the controller cannot be found, returns the Cms page with the URL /404. If the /404 page doesn't exist, returns the system 404 page.

Show inherited public methods

Inherited Public Methods

  • __call() - Handle calls to missing methods on the controller. (defined in Illuminate\Routing\Controller)
  • callAction() - Execute an action on the controller. (defined in Illuminate\Routing\Controller)
  • getMiddleware() - Get the middleware assigned to the controller. (defined in Illuminate\Routing\Controller)
  • middleware() - Register middleware on the controller. (defined in Illuminate\Routing\Controller)

Protected Methods

protected extendableIsAccessible()

protected extendableIsAccessible(
    mixed $class,
    string $propertyName
): boolean 

extendableIsAccessible checks if a property is accessible, property equivalent of is_callable()

protected extendableIsSettingDynamicProperty()

protected extendableIsSettingDynamicProperty(): bool 

extendableIsSettingDynamicProperty returns true if a dynamic property action is taking place

protected extensionExtractImplements()

protected extensionExtractImplements(): array 

extensionExtractImplements will return classes to implement.

protected extensionExtractMethods()

protected extensionExtractMethods(
    string $extensionName,
    object $extensionObject
): void 

extensionExtractMethods extracts the available methods from a behavior and adds it to the list of callable methods

protected findController()

protected findController(
    string $controller,
    string $action,
    string $inPath
): ControllerBase|false 

findController is used internally to find a backend controller with a callable action method

protected getExtendableMethodFromDynamicMethods()

protected getExtendableMethodFromDynamicMethods($name): callable|null 

protected getExtendableMethodFromExtensions()

protected getExtendableMethodFromExtensions($name): array|null 

protected parseAction()

protected parseAction($actionName): string 

parseAction processes the action name, since dashes are not supported in PHP methods

protected runPageNotFound()

protected runPageNotFound(): void

runPageNotFound display a CMS 404 page, if one is available. For security reasons, the backend 404 page is not used unless an admin session is found, this prevents random discovery of the admin panel URL by crawlers or bots.