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

繼續閱讀

https://www.youtube.com/watch?v=ShrS3HXwzPg``` class PostController extends Controller { public function update(Post $post, before class PostController extends Controller { public function update($post_id, $post = Post::findOrFail($post_id); And many more things.

繼續閱讀

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 = []

繼續閱讀

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])

繼續閱讀

作者的圖片

Sue boy

Sueboy Can support You

CIO

Taiwan