This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

chris.vanderpoel7523
chris.vanderpoel7523

We have a fairly custom section of the site that isn't really suited to be managed as a component that we'd like to manage through a custom frontend controller.

What is the recommended way to create a custom frontend controller that is routed to through a plugin's route.php file? I'm assuming that it's safe to extend the Cms\Classes\Controller controller?

This is what I've been experimenting with right now...

plugins\our\namespace\routes.php

Route::get('/custom', [
    'as' => 'custon',
    'uses' => 'Our\Namespace\Controllers\CustomController@index'
]);

plugins\our\namespace\controllers\CustomController.php

class CustomController extends Cms\Classes\Controller {

    public function index()
    {
        return route('custom');
    }
}

I've tried the following route paths with no success.

  • themes\demo\custom.blade.php
  • themes\demo\custom.htm
  • plugins\our\namespace\controllers\custom\custom.blade.php
  • plugins\our\namespace\controllers\custom\custom.htm
<h1>Custom Controller</h1>

While this allows me to dd('testing') from the CustomController just fine, I'm a little stumped as to how to return a correct template file. Debugging the route generation from there has been a bit tricky.

Does anyone have recommendations for this type of custom stuff that needs to sit along-side October?

orzcc
orzcc

I'm care about this question,too~

daftspunky
daftspunky

Have a look at this Laravel API plugin, it demonstrates how to handle classic Laravel routing.

phamtranphu22891
phamtranphu22891

Can we use twig instead of blade?

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.