We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm recreating a Datatable to show the users, clicking on the Select All checkbox, it throw an exception on Collection::total does not exist.
UserTable.php
<?php namespace App\Http\Livewire; use App\Models\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\Auth; use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\Views\Column; class UserTable extends DataTableComponent { public bool $viewingManage = false; public $currentUser; public bool $paginationEnabled = false; public bool $columnSelect = false; public array $bulkActions = [ 'exportSelected' => 'Esporta', ]; public function columns(): array { return [ Column::make(__('Name')) ->sortable() ->searchable(), Column::make(__('E-mail'), 'email') ->sortable() ->searchable(), Column::make(__('Roles'), 'null'), Column::make(__('Permissions'), 'null'), Column::make(__('Verified'), 'email_verified_at') ->sortable(), Column::make(__('Manage'), null), ]; } public function query(): Builder { return User::query(); } public function rowView(): string { return 'users.row'; } public function exportSelected() { $this->alert('error', 'Funzione in aggiornamento.', [ 'position' => 'center', 'timer' => null, 'toast' => true, 'text' => '', 'confirmButtonText' => 'OK', 'cancelButtonText' => 'Cancella', 'showCancelButton' => false, 'showConfirmButton' => true, ]); } public function manage($id) { $this->viewingManage = true; $this->currentUser = User::findOrFail($id); } public function modalsView(): string { return 'users.manage'; } public function getTableRowUrl(): string { return '#'; } public function saveUsers() { session()->flash('message', 'Post successfully updated.'); $this->resetModal(); } public function resetModal(): void { $this->reset('viewingManage', 'currentUser'); } public function loginUsers() { $userRoles = Auth::user()->getRoleNames()->toArray(); if (in_array('Amministratore', $userRoles)) { Auth::loginUsingId($this->currentUser->id, true); } else { $this->alert('error', 'Impossibile accedere, non si dispone delle autorizzazioni necessarie!', [ 'position' => 'center', 'timer' => null, 'toast' => true, 'text' => '', 'confirmButtonText' => 'OK', 'cancelButtonText' => 'Cancella', 'showCancelButton' => false, 'showConfirmButton' => true, ]); } $this->resetModal(); return redirect(route('dashboard')); } }
The text was updated successfully, but these errors were encountered:
Fixed next release: 3eeb4f6
Sorry, something went wrong.
No branches or pull requests
I'm recreating a Datatable to show the users, clicking on the Select All checkbox, it throw an exception on Collection::total does not exist.
UserTable.php
The text was updated successfully, but these errors were encountered: