fix 1.2.4

This commit is contained in:
2026-06-07 23:05:48 +02:00
parent cd10d100ec
commit 4dd4da7f4b
5 changed files with 69 additions and 3 deletions
+13 -1
View File
@@ -8,6 +8,8 @@ use App\Models\Gruppo;
use App\Models\Individuo;
use App\Models\Diocesi;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Log;
class GruppoController extends Controller
@@ -17,6 +19,7 @@ class GruppoController extends Controller
$this->authorizeRead('gruppi');
$viewMode = request('view', 'table');
$perPage = in_array((int) request('perPage'), [10, 20, 25, 50, 100]) ? (int) request('perPage') : 20;
$user = auth()->user();
$vista = \App\Models\VistaReport::where('user_id', $user->id)
@@ -48,7 +51,16 @@ class GruppoController extends Controller
});
if ($viewMode === 'table') {
$gruppi = $this->sortGruppiHierarchically($allGruppi);
$sorted = $this->sortGruppiHierarchically($allGruppi);
$page = Paginator::resolveCurrentPage();
$gruppi = new LengthAwarePaginator(
$sorted->forPage($page, $perPage)->values(),
$sorted->count(),
$perPage,
$page,
['path' => Paginator::resolveCurrentPath()]
);
$gruppi->appends(request()->except('page'));
} else {
$gruppi = $allGruppi;
}
+2 -2
View File
@@ -9,8 +9,8 @@ class VistaReport extends Model
{
protected $table = 'viste_report';
protected $fillable = [
'user_id', 'nome', 'tipo', 'colonne_visibili',
'colonne_ordinamento', 'filtri', 'ricerca'
'user_id', 'nome', 'tipo', 'colonne_visibili',
'colonne_ordinamento', 'filtri', 'ricerca', 'is_default'
];
protected $casts = [