Laravel views
Twitter Github
Examples

List view examples

Error!
Success!
belal dd
mmk dd 45kjh
test
2132tytyiuaaaaa
cdcsdcb
keykha asfd232323
Just for testt adsf
test
test123
dwadwad
sdsd22333
test@test.test
tesdasda 33
javonte.kutch@example.comxfz
Bande de iok
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
belal dd
mmk dd 45kjh
test
2132tytyiuaaaaa
cdcsdcb
keykha asfd232323
Just for testt adsf
test
test123
dwadwad
sdsd22333
test@test.test
tesdasda 33
javonte.kutch@example.comxfz
Bande de iok
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
belal dd
mmk dd 45kjh
test
2132tytyiuaaaaa
cdcsdcb
keykha asfd232323
Just for testt adsf
test
test123
dwadwad
sdsd22333
test@test.test
tesdasda 33
javonte.kutch@example.comxfz
Bande de iok
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
belal dd
mmk dd 45kjh
test
2132tytyiuaaaaa
cdcsdcb
keykha asfd232323
Just for testt adsf
test
test123
dwadwad
sdsd22333
test@test.test
tesdasda 33
javonte.kutch@example.comxfz
Bande de iok
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
belal dd
belal dd
Admin
test
test
Writer
cdcsdcb
cdcsdcb
Writer
Just for testt adsf
Just for testt adsf
Admin
test123
test123
Admin
sdsd22333
sdsd22333
Admin
tesdasda 33
tesdasda 33
Admin
Bande de iok
Bande de iok
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()
        ];
    }
}