Reverts f73d8e6d49. While there are other ways to achieve some of the same end results, this code existed in the code base for 8 months without issues and is included in the official docs. This means that there could be devs that are depending on this behavior. Additionally, while this may make the internal logic to the BackendController class more complex, it simplifies the developer experience by bringing the Backend\Classes\Controller base class more in line with the standard Laravel controller class.
This was a contentious change is generally a bad idea to blanket all requests with a dependant cookie. We will try something else.
Revert enableXsrfCookies setting. Fixes UX issue introduced where the token expires. This should be replaced by a CSRF policy that determines whether this is needed on the front end.
runInternal has been removed because we do not want to blanket our response logic over every single response, only the happy path. This is because it is impossible to remove. So it is better to take the inverted approach, where if you want the CMS' headers in your custom response, add them yourself. This becomes easy via the new makeResponse() method
For some reason it was decided to allow October controllers to support Laravel middleware, this has been reverted because it is a convoluted solution that doesn't respect the original architecture. There are other ways to handle middleware requirements
The original use case appeared to be to simply allow backend controllers to inject headers. This is something easily solvable whilst keeping the simple and original workflow
I am using OctoberCMS without the CMS module (removed from modules directory and turned off in cms.php) and I am getting an error in the backend regarding missing `MediaManager` class. I wrapped this in a class_exists to check that MediaManager exists before binding it.
Let me know your thoughts.
This pipes all event calls through a new EventEmitter trait, which substitutes the October Rain event emitter trait. The view event has been moved to this trait also.
Pass some variables by reference to allow multi-extension.
Fixes#2420
When an AJAX handler is called for a widget, the view paths and specified variables should be merged in to the controller. This sets the appropriate context:
1) Look at the widget first
2) Fall back to the controller
Fixes#2432
Treat non scalar, non array, non RedirectResponse, non null as a Laravel compatible response
This brings AJAX handlers in line with page cycles, which do the same thing if the response is not a string. However in AJAX we should treat any scalar as a "result", not just a string. For all else (where not null), let Laravel handle it as a custom response object -- could be a model for serialization, or anything compatible.
Importantly to note when a custom redirect is sent, October's workflow is completely wiped out, so any partial updates, redirects, etc. will not occur. This is a normal and fair expectation.
Fixes#1784