fix(video-clips): check if created video exists before recreating it and failing

update seed scripts to prevent sql error when reloading install page
This commit is contained in:
Yassine Doghri 2022-01-21 17:25:27 +00:00
commit dff1208725
8 changed files with 70 additions and 23 deletions

View file

@ -176,11 +176,20 @@ class VideoClipsController extends BaseController
'updated_by' => user_id(),
]);
// Check if video clip exists before inserting a new line
if ((new ClipModel())->doesVideoClipExist($videoClip)) {
// video clip already exists
return redirect()
->back()
->withInput()
->with('error', lang('VideoClip.messages.alreadyExistingError'));
}
(new ClipModel())->insert($videoClip);
return redirect()->route('video-clips-list', [$this->podcast->id, $this->episode->id])->with(
'message',
lang('Settings.images.regenerationSuccess')
lang('VideoClip.messages.addToQueueSuccess')
);
}