Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. $post = Posts::find( $i);
  2.  
  3. if ( $post != null ) {
  4. $isOldPostFormatWithFileNameInBody = strpos( $post->body, '.' ) !== false;
  5. if ( $isOldPostFormatWithFileNameInBody ) {
  6. $att = \App\Attachments::create( [
  7. 'body' => $post->body,
  8. 'post_id' => $post->id,
  9. 'is_video' => false //TODO: добавить проверку на видео по расширению
  10. ] );
  11.  
  12. $post->body = $att->id;
  13. $post->save();
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement