PHP code example of performing / laravel-view-helpers

1. Go to this page and download the library: Download performing/laravel-view-helpers 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/ */

    

performing / laravel-view-helpers example snippets


return [
    'table' => [
        'use_filters' => true,

        'default_filters' => [
            Filter::make('Search')
                ->type('text')
                ->on(function ($query, $value) {
                    return $query->search($value);
                })
        ],

        'default_query' => [
            'per_page' => 15,
        ]
    ]
];

class PostController
{
    public function index(Request $request)
    {
        return Page::make('Posts')
            ->table(fn (Table $table) => $table
                ->rows(
                    Post::query()->latest(),
                    PostResource::class
                )
                ->columns([
                    Column::make('ID')->sortable(),
                    Column::make('Title', 'title')->sortable(),
                    Column::make('Azioni')->component(ColumnType::Actions)->sortable(),
                ])
            )->form([
                Input::make('Text'),
                Input::make('Password')->type('password'),
                Input::make('Dropdown')->type('select')->options([ 1 => 'one', 2 => 'two']),
                Input::make('Message')->type('textarea'),
            ])
            ->render('Posts/Index');
    }
}
bash
php artisan vendor:publish --tag="laravel-view-helpers-config"