I'm currently working with OctoberCMS and am creating a plugin which has a custom page with a widget which shows a grid
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
ftsf/grid/routes.php
<?php
Route::post('/backend/ftsf/grid', 'Ftsf\Grid\Widgets\GridManager@saveGrid');
ftsf/grid/widgets/GridManager.php
<?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.