Skip to content
Roberts Jurkjans edited this page Mar 9, 2018 · 1 revision

Concept

TODO

  • nodes
  • nested set
  • content

Define new page

TODO

  • migration
  • model

Registration

Page::register(App\Pages\TextPage::class)
    ->fields(function (FieldSet $fieldSet) {
        $fieldSet->add(new Arbory\Base\Admin\Form\Fields\Richtext('text'));
    })
    ->routes(function () {
        Route::get('/', App\Http\Controllers\TextPageController::class . '@index')->name('index');
    });

Controller

Active node is passed to related controller through dependency injection

class ProfileController extends Controller
{
    public function index(Node $node)
    {
        $page = $node->content;
        
        // do some cool stuff
    }
}

TIP: You can also get Node in controller's constructor and assign it to some property. This allows you to avoid from Node injection in every method.

Page content is available as $node->content relation.

Clone this wiki locally