Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant changes to the handling of tags in the application. It replaces the previous string-based tag system with a relational model using a new
Tag
entity. This change affects multiple parts of the codebase, including models, controllers, resources, and database interactions. The key improvements include better tag management, relational mapping between photos and tags, and enhanced query capabilities.Tag System Overhaul:
Introduction of the
Tag
Model:Tag
model (app/Models/Tag.php
) has been added to represent tags as entities in the database. It includes methods for relational mapping with photos and a utility methodTag::from()
to fetch or create tags dynamically.Relational Mapping Between Photos and Tags:
Photo
model now includes atags()
method to define aBelongsToMany
relationship with theTag
model, replacing the previous array-based tag handling.Refactoring of Tag Album:
TagAlbum
model now uses theTagArrayCast
class to handle tags asTag
objects instead of strings.Controller and Resource Updates:
Tag Management in Controllers:
PhotoController
andAlbumController
now handle tags using theTag
model, including syncing tags with photos and dynamically creating tags if they don't exist. [1] [2]Resource Representation:
name
in API resources likePhotoResource
andTagAlbumResource
. This ensures API responses are more user-friendly and consistent. [1] [2]Query and Search Enhancements:
Improved Query Handling:
PhotoSearch
andFrameController
. [1] [2]Custom Query Builder for Tags:
TagBuilder
class has been introduced to extend query capabilities for theTag
model.These changes collectively enhance the application's ability to manage and query tags, improving both backend efficiency and frontend usability.