PHP code example of swarakaka / darejer

1. Go to this page and download the library: Download swarakaka/darejer 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/ */

    

swarakaka / darejer example snippets


use Darejer\Screen\Screen;
use Darejer\Screen\Section;
use Darejer\Components\TranslatableInput;
use Darejer\Components\SelectComponent;
use Darejer\Actions\SaveAction;
use Darejer\Actions\CancelAction;

public function create(): Response
{
    return Screen::make('New Product')
        ->sections([
            Section::make('general')
                ->title(__darejer('General'))
                ->components(['name', 'category', 'status']),
        ])
        ->components([
            TranslatableInput::make('name')
                ->label('Product Name')
                ->

use Darejer\Screen\Section;

Screen::make(__darejer('Edit User'))
    ->sections([
        Section::make('identity')
            ->title(__darejer('Identity'))
            ->components(['username', 'email']),

        Section::make('password')
            ->title(__darejer('Password'))
            ->collapsible()
            ->collapsed()
            ->components(['password', 'password_confirmation']),

        Section::make('access')
            ->title(__darejer('Access'))
            ->dependOn(['field' => 'role', 'operator' => 'in', 'value' => ['admin', 'manager']])
            ->components(['role_ids', 'permission_ids']),
    ])
    ->components([/* ... */])
    ->render();

use Darejer\Screen\Tab;

Screen::make(__darejer('Edit Product'))
    ->tabs([
        Tab::make(__darejer('General'))
            ->name('general')
            ->components(['name', 'slug', 'category_id']),

        Tab::make(__darejer('Pricing'))
            ->name('pricing')
            ->components(['price', 'cost', 'tax_rate']),

        Tab::make(__darejer('SEO'))
            ->name('seo')
            ->dependOn(['field' => 'is_published', 'operator' => '=', 'value' => true])
            ->components(['meta_title', 'meta_description']),
    ])
    ->components([/* ... */])
    ->render();
bash
composer key:generate
php artisan darejer:install
php artisan migrate --seed
bash
npm install
npm run dev
php artisan serve