https://tonylea.com/setting-alpine-data-outside-of-the-component
<div x-data="{good_id: '', good_name: ''}" id="good_info" class="w-full" @set_good_data=" good_id = $event.detail.good_id; good_name = $event.detail.good_name; "> <div x-text="good_id"></div> <div x-text="good_name"></div> </div> <script> document.getElementById('good_info').dispatchEvent(new CustomEvent('set_good_data', { detail: { good_id: 1234, good_name: 'Apple', } })); </script>
https://github.com/sueboy19/livewire_demo
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.
composer require "illuminate/database" composer require "illuminate/events" Config/Events.php
use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Events\Dispatcher; use Illuminate\Container\Container; function boostEloquent() { $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => 'password', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ]); // Set the event dispatcher used by Eloquent models... (optional) $capsule->setEventDispatcher(new Dispatcher(new Container)); // Make this Capsule instance available globally via static methods.
Golang Gin Api become Windows Service Use github.com/kardianos/service
package main import ( "errors" "fmt" "io" "log" "net" "net/http" "os" "path/filepath" "strings" "time" "github.com/gin-gonic/gin" "github.com/joho/godotenv" "github.com/kardianos/service" ) // Process Windows Service // github.com/kardianos/service var logger service.Logger type program struct{} func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. go p.run() return nil } func (p *program) Stop(s service.Service) error { // Stop should not block.
Modify ModelTrait file at \App\Traits
namespace App\Traits; trait ModelTrait { // fetaure Maybe belongsTo // get result but not effect this, keep this ORM status public function newSelfObject() { return $this->db->query($this->builder->getCompiledSelect(false)); } // copy self object return ORM Object public function cso() { $class_name = get_class($this); $class_new_object = (new $class_name); $class_new_object->builder = clone $this->builder; return $class_new_object; } public function hasOne($class, $relation_primary_key=null, $primary_key=null) { return $class->where($relation_primary_key ?? $this->primaryKey, $this->newSelfObject()->getRowArray()[$primary_key ?
https://localhost.run/docs/