@wireUiStyles @wireUiScripts

Complex

0
0
0.0000
0
0
RT-97C Heavy Blaster
1
3
3
3.0000
3
3
Force Lightning, T-21 Light Blaster
2
2, 6
8
4.0000
2
6
RT-97C Heavy Blaster
1
3
3
3.0000
3
3
T-21 Light Blaster
1
2
2
2.0000
2
2
Bowcaster, Force Lightning, Shock Grenade
3
4, 6, 7
17
5.6667
4
7
RT-97C Heavy Blaster, Shock Grenade
2
3, 4
7
3.5000
3
4
Force Lightning
1
6
6
6.0000
6
6
0
0
0.0000
0
0
Force Lightning, Thermal Detonator
2
5, 6
11
5.5000
5
6
Results 11 - 20 of 2000
<livewire:relation-demo-table />
<?php

namespace App\Http\Livewire;

use App\User;
use App\Planet;
use App\Region;
use App\Weapon;
use Illuminate\Support\Carbon;
use Mediconesystems\LivewireDatatables\Column;
use Mediconesystems\LivewireDatatables\NumberColumn;
use Mediconesystems\LivewireDatatables\Http\Livewire\LivewireDatatable;

class RelationDemoTable extends LivewireDatatable
{
    public $hideable = 'inline';
    public $exportable = true;

    public function builder()
    {
        return User::query();
    }

    public function columns()
    {
        return [
            NumberColumn::name('id')
                ->label('ID')
                ->filterable()
                ->linkTo('user', 6),

            Column::name('weapons.name')
                ->filterable($this->weapons->pluck('name'))
                ->label('Weapon Names'),

            NumberColumn::name('weapons.id:count')
                ->filterable()
                ->label('Weapon Count'),

            NumberColumn::name('weapons.id:group_concat')
                ->filterable()
                ->label('Weapon Concat'),

            NumberColumn::name('weapons.id:sum')
                ->filterable()
                ->label('Weapon Sum'),

            NumberColumn::name('weapons.id:avg')
                ->filterable()
                ->label('Weapon Avg'),

            NumberColumn::name('weapons.id:min')
                ->filterable()
                ->label('Weapon Min'),

            NumberColumn::name('weapons.id:max')
                ->filterable()
                ->label('Weapon Max'),
        ];
    }

    public function getPlanetsProperty()
    {
        return Planet::pluck('name');
    }

    public function getRegionsProperty()
    {
        return Region::pluck('name');
    }

    public function getWeaponsProperty()
    {
        return Weapon::all();
    }

    public function bedtime($date)
    {
        if (!$date) {
            return;
        }
        return Carbon::parse($date)->isPast()
            ? Carbon::parse($date)->addDay()->diffForHumans(['parts' => 2])
            : Carbon::parse($date)->diffForHumans(['parts' => 2]);
    }
}