morphTo()method is used by the class that is related to all the other classes.
morphMany()method is called by the
So, let's edit our models like this:
// file: app/Photo.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class Photo ...
Polymorphic relationship, where a model is related to other several models depends on the record type is saved.
Share this highlighthttp://www.safaribooksonline.com/a/learning-laravels-eloquent/601797/