wayofdev/laravel-cycle-orm-adapter
import {Callout} from "nextra-theme-docs"; import ExternalLink from "../../components/external-link";
The BelongsTo relationship links one entity to another unique entity. For instance, if each post belongs to a user, this relationship can be annotated in the Post entity.
<?php
declare(strict_types=1);
namespace App\Entities;
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use Cycle\Annotated\Annotation\Relation\BelongsTo;
#[Entity]
class Post
{
#[Column(type: 'primary')]
private $id;
#[Column(type: 'string')]
private $title;
#[Column(type: 'text')]
private $content;
#[BelongsTo(target: 'App\Entities\User')]
private $user;
}
How can I help you explore Laravel packages today?