Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $post = Posts::find( $i);
- if ( $post != null ) {
- $isOldPostFormatWithFileNameInBody = strpos( $post->body, '.' ) !== false;
- if ( $isOldPostFormatWithFileNameInBody ) {
- $att = \App\Attachments::create( [
- 'body' => $post->body,
- 'post_id' => $post->id,
- 'is_video' => false //TODO: добавить проверку на видео по расширению
- ] );
- $post->body = $att->id;
- $post->save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement