-
Notifications
You must be signed in to change notification settings - Fork 32
Pages
Roberts Jurkjans edited this page Mar 9, 2018
·
1 revision
TODO
- nodes
- nested set
- content
TODO
- migration
- model
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');
});
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.