Laravel views
Twitter Github
Examples

List view examples

Error!
Success!
belal ddx
mmk dd
test
2132tytyiuaaaaa
cdcsdc
keykha asfd2
Just for testt adsf
test
test123
dwadwad
sdsd
test@test.test
tesdasda
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 ddx
mmk dd
test
2132tytyiuaaaaa
cdcsdc
keykha asfd2
Just for testt adsf
test
test123
dwadwad
sdsd
test@test.test
tesdasda
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 ddx
mmk dd
test
2132tytyiuaaaaa
cdcsdc
keykha asfd2
Just for testt adsf
test
test123
dwadwad
sdsd
test@test.test
tesdasda
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 ddx
mmk dd
test
2132tytyiuaaaaa
cdcsdc
keykha asfd2
Just for testt adsf
test
test123
dwadwad
sdsd
test@test.test
tesdasda
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 ddx
belal ddx
Writer
test
test
Admin
cdcsdc
cdcsdc
Admin
Just for testt adsf
Just for testt adsf
Admin
test123
test123
Admin
sdsd
sdsd
Admin
tesdasda
tesdasda
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()
        ];
    }
}