aw-studio/laravel-content-parser

dev-main 2021-12-10 10:45 UTC

This package is auto-updated.

Last update: 2024-04-10 15:58:08 UTC


README

Install

composer require aw-studio/laravel-content-parser

Usage

use AwStudio\ContentParser\Content;

class Site extends Model
{
    protected $casts = [
        'content' => Content::class,
    ];
}

Using Relationships

Setup the related query:

class Site extends Model
{
    // ...

    public function authorQuery()
    {
        return User::query();
    }
}

One relation:

[
    {
        "type": "author",
        "value": "relation://author@1"
    }
]

Many relation:

[
    {
        "type": "author",
        "value": "relation://author@1,2"
    }
]