PHP code example of aristonis / laravel-livewire-dataview

1. Go to this page and download the library: Download aristonis/laravel-livewire-dataview 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/ */

    

aristonis / laravel-livewire-dataview example snippets


   

   namespace App\Livewire\Users;

   use App\Models\User;
   use Aristonis\LaravelLivewireDataview\DataViewComponent;

   class UserTable extends DataViewComponent
   {
       protected function configure(): void
       {
           $this->setItemView('users.user-table-item');
           $this->setPerPage(20);
       }

       protected function query()
       {
           return User::query()->with('roles')->orderByDesc('created_at');
       }
   }
   
bash
php artisan vendor:publish --tag=dataview-views    # copues views component and customize it
php artisan vendor:publish --tag=dataview-config   # copies config/dataview.php
php artisan vendor:publish --tag=dataview-stubs    # copies stub templates