@RobertBaelde Are you able to post some code? There’s no reason why writing line breaks to a file should work in a controller action and not in a queued job.
Linebreaks dont work using a queue
I have a controller that generates an text file and uploads it to my dropbox. Everything worked fine. However i moved the file generating code to a job. So i could use a queue to manage the file generation.
I used \n for the linebreaks. But this doesn't work when using the queue. I think it has something to do with that the php is executed by the cli.
How can i get the line breaks working in a job using queues?
I also figured that on both files those linebreaks didn't work. and that the controller generated the linebreaks because they were in the file. So this generated new lines
"foo \n
Bar"
And this didn't:
"foo \n bar"
Here is the code from within the controller and the job:
Controller:
$filecontent = "
Foo \n
Bar";
Storage::disk('dropbox')->put('test_'.uniqid().'.txt', $filecontent);
$this->dispatch(new MoveOrderFiles([]));
return 'true';
Job:
$filecontent = "
Foo \n
Bar";
Storage::disk('dropbox')->put('test_queue_'.uniqid().'.txt', $filecontent);
EDIT: Figured out "\r\n" was the solution..
Please or to participate in this conversation.