Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel database insert with combining array and string

<?php
$attendanceList = [18354012,18354013,18354014,18354015];
$present = "FALSE";

$insertData = array_map(
    fn($el)=>['id'=>$el, 'present'=>$present],
    $attendanceList
);

$db::table("attendance")->insert($insertData); 
 
PREVIOUS NEXT
Tagged: #Laravel #database #insert #combining #array #string
ADD COMMENT
Topic
Name
2+8 =