classes/Relation.md

Relation (trait)

Overview:

Relation defines relationships between Model classes and adds lazy-loading accessors.

Use the Relation trait to declare one-to-one and one-to-many links between models and access related data lazily.

Key behavior:

Public API:

Example:

class Post extends Model { public $id; }
class Comment extends Model { public $post_id; }
Post::hasMany('Comment.post_id');