Upload beautify

This commit is contained in:
2026-02-14 15:14:12 +01:00
parent e129618910
commit 79192345e3
249 changed files with 24436 additions and 1021 deletions

View File

@@ -4,6 +4,9 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use App\Models\Artwork;
class ContentType extends Model
{
@@ -19,6 +22,18 @@ class ContentType extends Model
return $this->categories()->whereNull('parent_id');
}
/**
* Return an Eloquent builder for Artworks that belong to this content type.
* This traverses the pivot `artwork_category` via the `categories` relation.
* Note: not a direct Eloquent relation (uses whereHas) so it can be queried/eager-loaded manually.
*/
public function artworks(): EloquentBuilder
{
return Artwork::whereHas('categories', function ($q) {
$q->where('content_type_id', $this->id);
});
}
public function getRouteKeyName(): string
{
return 'slug';