PHP code example of cubesystems / leaf

1. Go to this page and download the library: Download cubesystems/leaf library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cubesystems / leaf example snippets


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' );
    } );

Admin::modules()->register(  App\Http\Controllers\Admin\TextController::class );

$currentNode = app( Arbory\Base\Nodes\Node::class );
$nodes = app( Arbory\Base\Repositories\NodesRepository::class ); 

// returns only the active children of the current node
$nodes->findUnder( $currentNode );

$form->addField( new Text( 'title' ) )->setRules( '

$form->addField( new Translatable( ( new Text( 'title' ) )->rules( '

new Arbory\Base\Admin\Form\Fields\ObjectRelation( 'field_name', Arbory\Base\Nodes\Node::class );

new ObjectRelation( 'field_name', Arbory\Base\Nodes\Node::class, 1 ); // single relation, compact view 
new ObjectRelation( 'field_name', Arbory\Base\Nodes\Node::class, 10 ); 

( new ObjectRelation( 'field_name', Arbory\Base\Nodes\Node::class ) )->setIndentAttribute( 'depth' );

$getName = function( \Arbory\Base\Nodes\Node $model ) 
{
    return class_basename( $model->content_type );
};

( new ObjectRelation( 'field_name', Arbory\Base\Nodes\Node::class ) )->groupBy( 'content_type', $getName );

return [
    'my_letter' => [
        'to' => 'a friend',
        'subject' => 'Hello!'
    ]
]

Settings::has('my_letter.to'); // true
Settings::get('my_letter.to'); // "a friend"

return [
    'my_setting_key' => [
        'value' => 'My setting value',
        'type' => Arbory\Base\Admin\Form\Fields\CompactRichtext::class
    ],
]

return [
    'my_setting_file' => [
        'value' => null,
        'type' => Arbory\Base\Admin\Form\Fields\ArboryFile::class
    ],
    'my_setting_image' => [
        'value' => null,
        'type' => Arbory\Base\Admin\Form\Fields\ArboryImage::class
    ],
]

return [
    'hello' => [
        'type' => Arbory\Base\Admin\Form\Fields\Translatable::class,
        'value' => [
            'type' => Arbory\Base\Admin\Form\Fields\CompactRichtext::class,
            'value' => [
                'en' => 'Hello',
                'lv' => 'Sveiks'
            ]
        ]
    ],
]
bash
php artisan arbory:install
bash
php artisan arbory:create-user