optimizations
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Uploads\Services;
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\User;
|
||||
use App\Uploads\Exceptions\DraftQuotaException;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
@@ -79,11 +80,10 @@ final class DraftQuotaService
|
||||
|
||||
private function publishedMainHashExists(string $hash): bool
|
||||
{
|
||||
return DB::table('upload_files as uf')
|
||||
->join('uploads as u', 'u.id', '=', 'uf.upload_id')
|
||||
->where('uf.type', 'main')
|
||||
->where('uf.hash', $hash)
|
||||
->where('u.status', 'published')
|
||||
return Artwork::query()
|
||||
->where('hash', $hash)
|
||||
->where('artwork_status', 'published')
|
||||
->whereNotNull('published_at')
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user