Search
 
SCRIPT & CODE EXAMPLE
 

PHP

livewire model bind item in array

#Using a multi-dimensional array that looks like this:
$data = [
   1 => ['name' => 'Name', 'completed' => 0],
   2 => ['name' => 'Name 2', 'completed' => 1],
];
#Bind items like so:
@foreach ($items as $item)
   <x-input wire:model="data.{{ $item->id }}.name" type="text" />
   <x-input wire:model="data.{{ $item->id }}.completed" type="checkbox" />
@endforeach
Comment

PREVIOUS NEXT
Code Example
Php ::  
Php :: Csv To AssoT Php 
:: remove null values from array php 
Php :: laravel get url parameters in controller 
Php :: Uncaught RedisException: Redis server went away in 
Php ::  
Php :: generate a unique id 
Php :: blade format date 
Php :: netchain media 
Php :: php unset by value 
Php :: php base58 decode 
Php :: php fetch return false 
Php :: page.php woocommerce 
Php :: Declare A PHP Array 
Php :: laravel relationship retrieve data 
Php ::  
Php :: wordpress get all published post 
Php :: php pass a function as a parameter 
::  
:: spatie/laravel-activitylog display only changed data 
Php :: php session 
:: create services in laravel with command line 
Php :: mailjet 
Php :: run cron job in seconds 
Php :: phpdoc example 
Php :: open phpstorm from terminal 
Php :: route parameter type laravel 
Php :: Bd phone number validation in laravel 
Php :: put_assoc 
Php :: validate phone number with dial code laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =