Livewire resize But...

2024 laravel conf demo transfer big size to small size. https://www.youtube.com/watch?v=VmXbw9GU1SU&t=7484s 2:02:00 Start livewire ListPost.php public function render() { return view('livewire.list-post'); } public function t() { info('t'); } list-post.blade.php <div> <div class="container"> <div class="row"> <div class="col-md-12"> <h1>List Post</h1> <div> <button wire:click="t" class="btn btn-primary">T</button> </div> <div style="height:100px; overflow: auto; margin-top: 30px;"> <livewire:all-post /> </div> </div> </div> </div> </div> AllPost.php About 5MB datas public $Posts; public function mount() { $this->Posts = collect(); for ($i = 0; $i < 10000; $i++) { $this->Posts->push(collect([ 'title' => 'Post Title ' . $i, 'content' => 'Post Content ' . $i, ])); } } public function render() { return view('livewire.all-post'); } all-post.blade.php ...

2024-08-28 · 2 min · 313 words · Me

LiveWire meteor.js LiveView

Before using LiveWire, JavaScript was always the language used for both frontend and backend development. When choosing a framework, one of the most important factors to consider is validation. Validation is a crucial and time-consuming aspect of development. It needs to be performed on the frontend, backend, and when modifying the database through input, update, or delete operations. In some cases, the validation process may be performed twice. Typically, the backend performs validation using the same language. This makes validation a reusable function. On the other hand, the frontend often uses JavaScript, which is a different language. ...

2024-08-13 · 2 min · 261 words · Me

Livewire form and outside form with button action maybe different your think

In liveiwre word some button action and alpine @click action be clicked, livewire 3 update (ajax) is different your think. Component public $test_input=1; public function tt() { info('tt'); info($this->test_input); } blade <div class="row row-cols-1 row-cols-md-3 g-4" x-data> <form wire:submit="tt"> <input type="text" wire:model='test_input'> <button type="submit">form type=submit</button> {{-- // update (ajax) --}} <button type="button">form type=button</button> {{-- // No update (ajax) --}} <button wire:click='tt; $wire.test_input=3;'>form wire:click</button> {{-- // update (ajax) and run twice --}} <button @click='$wire.tt; $wire.test_input=3;'>form @click</button> {{-- // update (ajax) and run twice --}} </form> <button type="submit">out form type=submit</button> {{-- // No update (ajax) --}} <button type="button">out form type=button</button> {{-- // No update (ajax) --}} <button wire:click='tt; $wire.test_input=3;'>out form wire:click</button> {{-- // update (ajax) --}} <button @click='$wire.tt; $wire.test_input=3;'>out form @click</button> {{-- // update (ajax) --}} </div> So be careful and try to understand ...

2023-12-31 · 1 min · 147 words · Me

Laravel Livewire with WinNMP Part II

https://github.com/sueboy19/livewire_demo

2023-06-04 · 1 min · word · Me

Laravel Livewire with WinNMP

winnmp for windows a. create project livewire (Database and user auto create livewire) b. https://winnmp.wtriple.com/tutorial/laravel update composer a. mkdir new directory "t" b. cd t c. https://getcomposer.org/download/ c1. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" c2. php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" c3. php composer-setup.php c4. php -r "unlink('composer-setup.php');" c5. mv composer.phar to C:\WinNMP\bin\composer cd \WinNMP\WWW\livewire a. delete index.php b. composer create-project --prefer-dist laravel/laravel . c. composer require laravel/ui d. composer install e. edit .env e1. DB_DATABASE=livewire DB_USERNAME=livewire f. php artisan ui bootstrap --auth g. php artisan migrate h. developer tools composer require doctrine/dbal composer require --dev barryvdh/laravel-ide-helper composer require --dev beyondcode/laravel-dump-server composer require --dev barryvdh/laravel-debugbar composer require --dev roave/security-advisories:dev-master php artisan vendor:publish --provider="BeyondCode\DumpServer\DumpServerServiceProvider" php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider" I. php artisan key:generate install node.js for windows a. https://nodejs.org/zh-tw/download b. npm install c. npm run dev ...

2023-06-03 · 2 min · 249 words · Me

livewire checkbox

php``` public $check_items; public function mount() { $this->check_items = collect([“png” => true, “scs” => true, “scz” => false, “xml” => true, “pdf” => false, ]); } blade``` @forelse($check_items as $index => $item) @empty @endforelse

2021-09-29 · 1 min · 34 words · Me

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); 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()

2021-03-30 · 1 min · 142 words · Me

livewire locale lang

middleware routes/web.php``` Route::group([‘prefix’ => ‘member’, ‘as’ => ‘member.’, ‘middleware’ => [‘auth’, ‘setLocale:zh-tw’]], function () { Route::get(’/’, App\Http\Livewire\MemberList::class); }); app/Http/Middleware/SetLocale.php.php``` namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; class SetLocale { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next, string $lang) { app()->setLocale($lang); return $next($request); } }

2021-02-24 · 1 min · 60 words · Me

Search two time then change paginate table record have problem

https://github.com/livewire/livewire/issues/1908

2020-10-29 · 1 min · word · Me

laravel livewire file update Real-Time File Validation mutile files

 https://laravel-news.com/livewire-file-upload Real-Time File Validation``` use Livewire\Component; use Livewire\WithFileUploads; class Show extends Component { use WithFileUploads; public $files = []; public function updatedFiles() // 即時檢查檔案格式 { $this->validate([ 'files.*' => 'image|max:1024', // 1MB Max ]); } public function store() { $filenames = collect($this->photos)->map->store('photos'); 'files' => $filenames->implode(','), updatedFiles() is Hook into the “updated” updatedPhoto public $Photo updatedPhotos public $photos = [] updatedFile public $file updatedFiles public $files = []

2020-10-21 · 1 min · 66 words · Me

laravel livewire Name problem

Use - and lowwercase App/Http/Livewire/Order/DropdownMaterial.php``` class DropdownMaterial extends Component { resources/views/livewire/order/create.blade.php``` @livewire('order.dropdown-material', ['post' => $order_material_id])

2020-10-20 · 1 min · 15 words · Me

Laravel livewire have Big Problem!

When juse livewire at blade.php Must have Div At first. <div style="text-align: center"> <button wire:click="increment">+</button> <h1>{{ $count }}</h1> </div> + {{ $count }} {{ trans('global.add') }} {{ trans('cruds.order.title_singular') }}

2020-10-19 · 1 min · 29 words · Me

laravel livewire namespace

App/Http/Livewire/Orders.php``` namespace App\Http\Livewire; use Gate; use Livewire\Component; use Symfony\Component\HttpFoundation\Response; class Orders extends Component { public function render() { abort_if(Gate::denies(‘order_access’), Response::HTTP_FORBIDDEN, ‘403 Forbidden’); return view('livewire.order'); } } resources/views/livewire/order.blade.php @extends(’layouts.app’) @section(‘content’) @livewire(‘order.show’) @endsection App/Http/Livewire/Order/Show.php namespace App\Http\Livewire\Order; public function render() { abort_if(Gate::denies('order_access'), Response::HTTP_FORBIDDEN, '403 Forbidden'); $this->orders = Order::all(); // Order::where('owner_id', auth()->id())->get(); // 只能看自己 return view('livewire.order.show'); } resources/views/livewire/order/show.blade.php {{ virables }}

2020-10-19 · 1 min · 57 words · Me