As when you delete the article deleting the related table field pictures and further ACC. files pictures?
In General, there are three tables with these fields: posts: id, name, created_at,... imageables: imageable_id, imageable_type, file_id, title,... files: id, name, path, type, is_used...
also configured foreign key when deleting the file (tab. files) - removes a field from the table imageables
Each article is associated with multiple symbols (polymorphic relationship), with each image associated with one file.
Need deleting article to remove all related models of the images (in table imageables) + for the associated file (imageables) to set a field is_used = 0 (the file is then cleared for the crown for example...)
I want the next team it was all done by machine: \Post::find(1)->fieldImages()->delete()
and there was no need at all to follow table files