Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

add data one to many laravel

$employee = employee::find(1);

$salary1 = new Salary;
$salary->amount = '123456789';
$salary->payment_date = '15/07/2020';

$salary2 = new Salary;
$salary->amount = '123456789';
$salary->payment_date = '16/07/2020';

$employee = $employee->salary()->saveMany([$salary1, $salary2]);
 
PREVIOUS NEXT
Tagged: #add #data #laravel
ADD COMMENT
Topic
Name
8+5 =