dev (#1)
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s
Co-authored-by: Frank John Begornia <frank.begornia@yahoo.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -425,4 +425,44 @@ class UserModel extends Model
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
function insertRoster($data) {
|
||||
$i = DB::table('roster')
|
||||
->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getRoster($productId)
|
||||
{
|
||||
$i = DB::table('roster')
|
||||
->where('ProductId', $productId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function deleteRoster($idArray)
|
||||
{
|
||||
$deletedRows = DB::table('roster')
|
||||
->whereIn('Id', $idArray) // Replace 'id' with the actual column name if different
|
||||
->delete();
|
||||
|
||||
return $deletedRows; // Returns the number of rows deleted
|
||||
}
|
||||
|
||||
function updateRoster($data)
|
||||
{
|
||||
$updatedRows = 0;
|
||||
|
||||
foreach ($data as $item) {
|
||||
// Assuming each item contains an 'id' and the fields to update
|
||||
$id = $item['Id'];
|
||||
unset($item['Id']); // Remove 'id' from the update data
|
||||
|
||||
$updatedRows += DB::table('roster')
|
||||
->where('Id', $id)
|
||||
->update($item);
|
||||
}
|
||||
|
||||
return $updatedRows; // Returns the total number of rows updated
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user