OctoberCMS Routing Plugin Unresolvable Dependency Resolving

I'm currently working with OctoberCMS and am creating a plugin which has a custom page with a widget which shows a grid Grid pattern manager

As you can see in this image this grid can be managed and can be saved with the "Save changes" button. This will send a POST request to the server, but I have problems with "listening" for this POST request. Since the documentation of octoberCMS is not very good I'm trying to do this the way it would be done in Laravel. But even that doesn't work like it should.

Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Support\ServiceProvider


Route::post('/backend/ftsf/grid', 'Ftsf\Grid\Widgets\[email protected]');


<?php namespace Ftsf\Grid\Widgets;

use App;
use Backend\Classes\WidgetBase;
use Cms\Classes\Content;
use Cms\Classes\Controller;
use Cms\Classes\Theme;
use Cms\Twig\Extension;
use Ftsf\Grid\Models\PatternOrder;
use Illuminate\Http\Request;
use System\Twig\Engine as TwigEngine;

class GridManager extends WidgetBase {
    protected $defaultAlias = 'ftsf_grid_manager';

    public function init() {

    public function render() {
        $env = App::make('twig.environment');
        $env->addExtension(new Extension(new Controller(Theme::getActiveTheme())));

        return (new TwigEngine($env))->get($this->getViewPath('_gridmanager.htm'),
                                       ['patterns' => PatternOrder::orderBy('order')->with('pages')->get(),
                                        'contents' => Content::all()]);

    public function loadAssets() {
        $this->addCss('css/gridmanager.css', 'Ftsf.Grid');
        $this->addJs('js/gridmanager.js', 'Ftsf.Grid');

    public function saveGrid(Request $request){
        return dd($request);

If more information is needed just tell me what.



You should use the Octobers native AJAX handlers. The documentation is quite good for that in my opinion.

In that case the handler should look like this:

public function onSaveGrid(){
    return dd(post());

You can make the request like this:

$.request('onSaveGrid', {
    success: function() {

Of course you could also use the data-attributes API or call the handler on a DOM element. The documentation covers all these cases.