This repository has the main purpose to respond to the following asked question from Stack Overflow: https://stackoverflow.com/questions/68073778/laravel-polymorphic-many-to-many-relationship-pivot-table-with-relationship-to-a?noredirect=1#comment120387610_68073778
- The user needs to establish a relation between tree models using Polymorphic relations to attach resources and avoid duplication.
- The user wants to add some custom fields to the relation table and load this content when retrieving the assets.
- Check the README.md file on the Controllers folder.
- Clone the project.
- Configure a Database. I already included a Sqlite3 DB on the project. Just update the drive to sqlite and set the DB_DATABASE variable to your /project/route/path/./database/relations.db
- Migrate the Database.
php artisan migrate:fresh --seed # I use the seed flag to include some samples in the database.
- Review the Migrations
- Review the Models
- Check the Action Controller to understand how to retrieve and store information using Eloquent.