$orders->paginate(10)
$orders = $orders->paginate(10)
So
$this->orders->paginate(10)
$this->oorders = $this->oorders->paginate(10)
laravel ->paginate need becareful
When you use some model ->paginate
Get Illuminate\Pagination\LengthAwarePaginator But Value Don't Back To Variable.
livewire public variable eloquent for security column
Get livewire public variable
Front web Try to get public $order
document.addEventListener('livewire:load', function () {
console.log(@this.order);
Get empty Array
livewire window.livewire.find eloquent collection
https://github.com/livewire/livewire/issues/1641?fbclid=IwAR0uHylkj-1vg8p5jUoBgPYfuAYsWnBhgp6EK2bJcBce8ze-tdtAa8ElLNY#issuecomment-736146468
Eloquent Collection data won't be made available to the front end unless you have the collection properties specified in the $rules array as the contents are models, so the same conditions apply to it as apply to just a single model property. This is for security reasons so the whole collection and all properties aren't just sent to the front end.
See the example here of binding to an eloquent collection https://laravel-livewire.com/docs/2.x/properties......
But a standard collection (not eloquent) will work but only with primitive data types. If any models are added to the collection or any php objects (not eloquent models), they will be serialised into an array.
So eloquent use for public variable is OK.
======
Other way use makeHidden()
訂閱:
文章 (Atom)