fix: prevents self approval

This commit is contained in:
2024-01-14 11:19:59 -06:00
parent b14a77762d
commit e83f51885b
2 changed files with 7 additions and 0 deletions

View File

@@ -90,6 +90,9 @@ class ArtworkController extends Controller
'artwork_id' => 'required|exists:artworks,id'
]);
$artwork = Artwork::find($request->artwork_id);
if ($artwork->artist_id == $user->artists->first()->id) {
return redirect('/approve-artwork');
}
if (is_null($artwork->approved_by)) {
$artwork->approved_by = $user->artists->first()->id;
$artwork->save();