Advertisement
Guest User

Untitled

a guest
May 27th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. $startsWithArgs = "";
  2. $changeToOpts = "";
  3.  
  4. Attachment::chunk(100, function ($attachments) use ($startsWithArgs, $changeToOpts) {
  5. foreach($attachments AS $attachment) {
  6. if (starts_with($attachment->file_uri, $startsWithArgs)) {
  7. $newURI = $changeToOpts. explode($startsWithArgs, $attachment->file_uri)[1];
  8. $attachment->update([
  9. 'file_uri' => $newURI
  10. ]);
  11. }
  12. }
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement