Hello $data = User::paginate(5); return view('users',compact('data')); {!! $data->links() !!}
Laravel uses tailwind JIT mode which imports (when you run npm run dev
) required classes when they are needed, the pagination is not included in your HTML explicitly with links()
so I believe required classes are not included
in the file tailwind.config.js
, make sure that all the following are included in content:[]
content: [
'./resources/**/*.blade.php',
'./resources/**/*.js',
'./resources/**/*.vue',
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
],
app\Providers\AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Pagination\Paginator;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
//
}
public function boot()
{
Paginator::useBootstrap();
}
}
The following command: php artisan vendor:publish --tag=laravel-pagination
can be used to copy all the templates used by Laravel for pagination into the resources/vendor/pagination
directory.
This directory is included in tailwind.config.js
when configured with the default settings suggested by Tailwind for Laravel, so it's not necessary to add the pagination path in the content.
It's possible to keep only tailwind.blade.php
in resources/vendor/pagination
to avoid unnecessary duplication.
© 2022 - 2024 — McMap. All rights reserved.