|
@@ -168,10 +168,12 @@ class MusicRepository
|
|
|
public function musicEdit($request)
|
|
|
{
|
|
|
$post_music_rel = $this->postMusicCategoryRel->select('mid')->where('id', $request['id'])->first();
|
|
|
- $postMusic = new PostMusic();
|
|
|
- $post_music = $postMusic->where('id',$post_music_rel->mid)->first();
|
|
|
+ $post_music = $this->postMusic->where('id',$post_music_rel->mid)->first();
|
|
|
+ if($post_music == null) {
|
|
|
+ $post_music = new PostMusic();
|
|
|
+ $post_music->name = $request['name'];
|
|
|
+ }
|
|
|
$date = date('Y-m-d H:i:s');
|
|
|
- $post_music->name = $request['name'];
|
|
|
$post_music->url = $request['url'];
|
|
|
$post_music->music_duration = $request['music_duration'];
|
|
|
$post_music->updated_at = $date;
|