The Core Module has setup 3 base controllers. Each of these controllers extends the main BaseController and provides some seperate functionality to prepare and render the page.
# Base Controller
This controller is what the Frontend Backend and Api Base Controllers extend, we setup some methods that we need to create a page response.
Useful methods that are inherited from this class:
function boot(): void// this method gets run when the controller has been setupfunction setTheme($theme): bool// sets the current themefunction setLayout($layout): bool// sets the current layoutfunction setTitle($title, $seperator = '|'): bool// prepends $title to the current title (current title is set to the app name)function setView($view, $data = [], $type = 'module'): object// determines where to load the view fromfunction getModuleNamespace($var, $module): string// returns a string with the module and var setup in namespace for, ready to be used in laravels views and lang functions
This pretty much replaces the view() from laravel. In here, you can specify the view file, and where to load from, whether its from the module, app, theme, or a custom namespace.
return $this->setView('partials.core.login', [], 'theme');This will load the login view from /themes/<theme>/views/partials/core/login.blade.php
return $this->setView('admin.datatable.index', [], 'module:Admin');This will load the datatable view from the admin module doesn't matter which module you call it from. Of course the module you call to has to be installed and enabled, otherwise the namespaces wont be registered.
# BaseFrontendController
This controller is what sets up what we need for the frontend. Currently it has no added methods. This is the controller you should extend for any frontend pages.
# BaseBackendController
This controller is what sets up the backend theme, and a few bits of functionality. Most the backend controllers will be extending this.
Useful methods in this class:
function setActions(array $actions): void// this sets the action buttonsfunction addPageAssets(): void// this method will search the assets directory to see if there is a css file for this view
# BaseApiController
The BaseApiController has a few useful methods for outputting the responses back in the needed format.
function sendResponse($message = 'ok', $status = 200, $data = []): void// sends a generic responsefunction sendError($message, $status = 500): void// sends an error status with messagefunction sendOK($message, $status = 200): void// sends and ok status with message