Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadmurad committed Aug 3, 2022
1 parent fc539cc commit d0d985c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Http/Controllers/SubjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ public function update(Request $request, Subject $subject)
'category_id' => $request->get('category_id'),
]);
if ($request->hasFile('cover')) {
$subject->getFirstMedia('cover')->delete();
if ($subject->hasMedia('cover')){
$subject->getFirstMedia('cover')->delete();
}

$subject->addMediaFromRequest('cover')->toMediaCollection('cover');
}

Expand Down

0 comments on commit d0d985c

Please sign in to comment.