Laravel views
Twitter Github
Examples

List view examples

Error!
Success!
efxcvsd sssss
ebrahimi
weddvds
shariat
ffrt
keykha
jhgg sdfsdf
kkkk77
test
test
sdsd
cummerata@example.org
tesdasda
javonte.kutch@example.comxfz
Bande de
qcollier@example.uk
Brycen Schade
celestinoprenner@example.net
Mrs. Kassandra Stiedemann
griffin.aufderha00r@example.net
  
<?php

namespace App\Http\Livewire\ListView;

use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use LaravelViews\Views\ListView;

class UsersListView extends ListView
{
    public $paginate = 10;

    /**
     * Sets a initial query with the data to fill the table
     *
     * @return Builder Eloquent query
     */
    public function repository(): Builder
    {
        return User::query();
    }

    /**
     * Sets the properties to every list item component
     *
     * @param $model Current model for each card
     */
    public function data($model)
    {
        return [
            'avatar' => asset('storage/' . $model->avatar),
            'title' => $model->name,
            'subtitle' => $model->email,
        ];
    }
}

  
Error!
Success!
Users Type Filter
Users Active Filter
Users Created At Filter
efxcvsd sssss
ebrahimi
weddvds
shariat
ffrt
keykha
jhgg sdfsdf
kkkk77
test
test
sdsd
cummerata@example.org
tesdasda
javonte.kutch@example.comxfz
Bande de
qcollier@example.uk
Brycen Schade
celestinoprenner@example.net
Mrs. Kassandra Stiedemann
griffin.aufderha00r@example.net
  
<?php

namespace App\Http\Livewire\ListView;

use App\Filters\UsersActiveFilter;
use App\Filters\UsersCreatedAtFilter;
use App\Filters\UsersTypeFilter;

class UsersWithFiltersListView extends UsersListView
{
    public $searchBy = ['name', 'email'];

    protected function filters()
    {
        return [
            new UsersTypeFilter,
            new UsersActiveFilter,
            new UsersCreatedAtFilter
        ];
    }
}

  
Error!
Success!
Users Type Filter
Users Active Filter
Users Created At Filter
efxcvsd sssss
ebrahimi
weddvds
shariat
ffrt
keykha
jhgg sdfsdf
kkkk77
test
test
sdsd
cummerata@example.org
tesdasda
javonte.kutch@example.comxfz
Bande de
qcollier@example.uk
Brycen Schade
celestinoprenner@example.net
Mrs. Kassandra Stiedemann
griffin.aufderha00r@example.net
  
<?php

namespace App\Http\Livewire\ListView;

use App\Actions\ChangeUserAsAdmin;
use App\Actions\ChangeUserAsWriter;
use App\Actions\ToggleUserAction;

class UsersWithActionsListView extends UsersWithFiltersListView
{
    protected function actionsByRow()
    {
        return [
            new ChangeUserAsAdmin,
            new ChangeUserAsWriter,
            new ToggleUserAction
        ];
    }
}

  
Error!
Success!
Users Type Filter
Users Active Filter
Users Created At Filter
efxcvsd sssss
ebrahimi
weddvds
shariat
ffrt
keykha
jhgg sdfsdf
kkkk77
test
test
sdsd
cummerata@example.org
tesdasda
javonte.kutch@example.comxfz
Bande de
qcollier@example.uk
Brycen Schade
celestinoprenner@example.net
Mrs. Kassandra Stiedemann
griffin.aufderha00r@example.net
  
<?php

namespace App\Http\Livewire\ListView;

use App\Actions\Bulk\ChangeUsersAsAdmin;
use App\Actions\Bulk\ChangeUsersAsWriter;

class UsersWithBulkActionsListView extends UsersWithActionsListView
{
    public function bulkActions()
    {
        return [
            new ChangeUsersAsAdmin,
            new ChangeUsersAsWriter,
        ];
    }
}

  
Error!
Success!
Users Type Filter
Users Active Filter
Users Created At Filter
efxcvsd sssss
efxcvsd sssss
Writer
weddvds
weddvds
Admin
ffrt
ffrt
Admin
jhgg sdfsdf
jhgg sdfsdf
Admin
test
test
Admin
sdsd
sdsd
Admin
tesdasda
tesdasda
Admin
Bande de
Bande de
Admin
Brycen Schade
Brycen Schade
Admin
Mrs. Kassandra Stiedemann
Mrs. Kassandra Stiedemann
Admin
  
<?php

namespace App\Http\Livewire\ListView;

use Carbon\Carbon;

class UsersWithCustomComponentListView extends UsersWithActionsListView
{
    public $itemComponent = 'components.custom-list-item';

    /**
     * Sets the properties to every list item component
     *
     * @param $model Current model for each card
     */
    public function data($model)
    {
        return [
            'date' => Carbon::now()
        ];
    }
}