Article management is the most advanced example included in the Pro theme, because every article has a picture, belongs to a category and has multiple tags. To access this example click the "Examples/Article Management" link in the left sidebar or add /article to the URL.
Here you can manage the articles. A list of articles will appear once you start adding them (to access the add page click "Add article"). On the add page, besides the Name and Description fields (which are present in most of the CRUD examples) you can see a category dropdown, which contains the categories you added, a file input and a tag multi select. If you did not add any categories or tags, please go to the corresponding sections (category management, tag management) and add some.
The code for saving a new article is a bit different than before (see snippet bellow):
Notice how the picture and tags are easily saved in the database and on the disk.
Similar to all the examples included in the theme, this one also has validation rules in place. Note that the picture is mandatory only on the article creation. On the edit page, if no new picture is added, the old picture will not be modified.
In the article management we have an observer (`app\Observers\ArticleObserver`) example. This observer handles the deletion of the picture from the disk when the article is deleted or when the picture is changed via the edit form. The observer also removes the association between the article and the tags.
The policy which authorizes the user on article
management pages is implemented in