in laravel is there a way to run code in the background?
For example:
public function video_merge()
{
$video1="video1.mp4";
$video2="video2.mp4";
$cmd="command to merge video1 and video2";
$id="xxxxxxxxxxxxx";//This "ID" I will use to check if the video has been merged
//this code i want it to run in the background
exec($cmd);
updateStatusMerge($id,'ready'); //This function I will use to update the status is: video merging completed
//end code running in the background
return response()->json([
'status'=>'processing',
'id'=>$id
]);
}
In the above code I want to merge two videos video1.mp4 and video2.mp4 with ffmpeg command how to make exec($cmd); updateStatusMerge($id,'ready');
run in the background
Any documents or suggestions?