PHP code example of milenmk / laravel-simple-datatables

1. Go to this page and download the library: Download milenmk/laravel-simple-datatables 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/ */

    

milenmk / laravel-simple-datatables example snippets


use Milenmk\LaravelSimpleDatatablesAndForms\Traits\HasTable;

class UserList extends Component
{
    use HasTable;

    public function table(Table $table): Table
    {
        return $table
            ->query(User::query())
            ->schema([
                TextColumn::make('name')->searchable()->sortable(),
                TextColumn::make('email')->searchable(),
                ToggleColumn::make('is_active')->label('Active'),
            ])
            ->striped()
            ->paginate();
    }
}

use Milenmk\LaravelSimpleDatatablesAndForms\Traits\HasForm;

class CreateUser extends Component
{
    use HasForm;

    public function form(Form $form): Form
    {
        return $form->model(User::class)->schema([
            InputField::make('name')->
bash
php artisan simple-datatables-and-forms:publish-assets
bash
php artisan make:milenmk-datatable UserList User --generate
js
// tailwind.config.js
module.exports = {
    content: [
        // ... your existing content paths
        './vendor/milenmk/laravel-simple-datatables-and-forms/resources/views/**/*.blade.php',
    ],
    // ... rest of your configuration
};