comma-separated value in laravel

I want to create a table valued function in SQL Server, which I want to return data in comma separated pass values.


<?php

$str = "1,2,3,4,5";
$data = (explode(","$str));


for ($x = 1; $data.length - 1; $x++) {
  
          $tbl = new tbl_name;
          $tbl->user_id = $x;
          $tbl->user_name = 'laratuto.com';
          $tbl->save();

}

?>

Leave a Comment