Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 50 lines 1.1 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\App\Bsky\Graph; 4 5use Carbon\Carbon; 6use SocialDept\AtpSchema\Data\Data; 7use SocialDept\AtpSchema\Generated\Com\Atproto\Repo\StrongRef; 8 9/** 10 * GENERATED CODE - DO NOT EDIT 11 * 12 * Lexicon: app.bsky.graph.follow 13 * Type: record 14 */ 15class Follow extends Data 16{ 17 public function __construct( 18 public readonly string $subject, 19 public readonly Carbon $createdAt, 20 public readonly ?StrongRef $via = null 21 ) { 22 } 23 24 /** 25 * Get the lexicon NSID for this data type. 26 * 27 * @return string 28 */ 29 public static function getLexicon(): string 30 { 31 return 'app.bsky.graph.follow'; 32 } 33 34 35 /** 36 * Create an instance from an array. 37 * 38 * @param array $data The data array 39 * @return static 40 */ 41 public static function fromArray(array $data): static 42 { 43 return new static( 44 subject: $data['subject'], 45 createdAt: Carbon::parse($data['createdAt']), 46 via: isset($data['via']) ? StrongRef::fromArray($data['via']) : null 47 ); 48 } 49 50}