Я просто пытаюсь следовать за Bootcamp для Laravel с помощью LiveWire: https://bootcamp.laravel.com/livewire/showing-chirps, так что у него есть примечание:
Возвращение всех чирп сразу не будет масштабироваться в производстве. Взгляните на мощную страницу Pagination
Laravel для повышения производительности. />
< /code>
@foreach ($chirps as $chirp)
...
@endforeach
< /code>
Reading the documentation it only include examples for the "class version" https://livewire.laravel.com/docs/pagin ... asic-usage like:
use Livewire\WithPagination;
use Livewire\Volt\Component;
use App\Models\Post;
new class extends Component {
use WithPagination;
public function with(): array
{
return [
'posts' => Post::paginate(10),
];
}
}
< /code>
So I already tried importing the trait in the view like:
use Livewire\WithPagination;
$getChirps = fn () => $this->chirps = Chirp::paginate(10);
< /code>
or
$getChirps = function () {
return $this->chirps = Chirp::with('user')->paginate(15);
};
< /code>
And I'm getting the next error:
Property type not supported in Livewire for property:
[{"current_page":1,"data":[{"id":1,"user_id":1,"message":"This chirp
is a
test","created_at":"2025-02-14T03:24:24.000000Z","updated_at":"2025-02-14T03:24:24.000000Z","user":{"id":1,"name":"Roberto","email":"robertohdll@gmail.com","email_verified_at":null,"created_at":"2025-02-09T14:10:52.000000Z","updated_at":"2025-02-09T14:10:52.000000Z"}}],"first_page_url":"http://127.0.0.1:8000/chirps?page=1","f ... =1","links":[{"url":null,"label":"«
Previous","active":false},{"url":"http://127.0.0.1:8000/chirps?page=1","l ... bel":"Next
»","active":false}],"next_page_url":null,"path":"http://127.0.0.1:8000/chirps","per_page ... ,"total":1}]
So the query to the DB is working and is getting the pages, but the error is something else, I already tried to find any specific example for the pagination in the functional version but don't have any luck.
Could be great if somebody can help me to understand how to fix this Property type not supported message, or understand if is not possible to use the pagination with the Functional version.
Подробнее здесь: https://stackoverflow.com/questions/794 ... ion-not-cl
Как использовать страницу в Laravel LiveWire с функциональной версией, а не классом ⇐ Php
Кемеровские программисты php общаются здесь
1740358576
Anonymous
Я просто пытаюсь следовать за Bootcamp для Laravel с помощью LiveWire: https://bootcamp.laravel.com/livewire/showing-chirps, так что у него есть примечание:
Возвращение всех чирп сразу не будет масштабироваться в производстве. Взгляните на мощную страницу Pagination
Laravel для повышения производительности. />
< /code>
@foreach ($chirps as $chirp)
...
@endforeach
< /code>
Reading the documentation it only include examples for the "class version" https://livewire.laravel.com/docs/pagination#basic-usage like:
use Livewire\WithPagination;
use Livewire\Volt\Component;
use App\Models\Post;
new class extends Component {
use WithPagination;
public function with(): array
{
return [
'posts' => Post::paginate(10),
];
}
}
< /code>
So I already tried importing the trait in the view like:
use Livewire\WithPagination;
$getChirps = fn () => $this->chirps = Chirp::paginate(10);
< /code>
or
$getChirps = function () {
return $this->chirps = Chirp::with('user')->paginate(15);
};
< /code>
And I'm getting the next error:
Property type not supported in Livewire for property:
[{"current_page":1,"data":[{"id":1,"user_id":1,"message":"This chirp
is a
test","created_at":"2025-02-14T03:24:24.000000Z","updated_at":"2025-02-14T03:24:24.000000Z","user":{"id":1,"name":"Roberto","email":"robertohdll@gmail.com","email_verified_at":null,"created_at":"2025-02-09T14:10:52.000000Z","updated_at":"2025-02-09T14:10:52.000000Z"}}],"first_page_url":"http://127.0.0.1:8000/chirps?page=1","from":1,"last_page":1,"last_page_url":"http://127.0.0.1:8000/chirps?page=1","links":[{"url":null,"label":"«
Previous","active":false},{"url":"http://127.0.0.1:8000/chirps?page=1","label":"1","active":true},{"url":null,"label":"Next
»","active":false}],"next_page_url":null,"path":"http://127.0.0.1:8000/chirps","per_page":15,"prev_page_url":null,"to":1,"total":1}]
So the query to the DB is working and is getting the pages, but the error is something else, I already tried to find any specific example for the pagination in the functional version but don't have any luck.
Could be great if somebody can help me to understand how to fix this Property type not supported message, or understand if is not possible to use the pagination with the [b]Functional version[/b].
Подробнее здесь: [url]https://stackoverflow.com/questions/79462224/how-to-use-the-pagination-in-laravel-livewire-with-the-functional-version-not-cl[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия