We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I created a new ContextType file called LodgingBusiness. It looks like this:
LodgingBusiness
<?php namespace JsonLd\ContextTypes; class LodgingBusiness extends LocalBusiness { /** * Property structure * * @var array */ protected $structure = [ '@id' => null, 'starRating' => null, 'petsAllowed' => null, ]; }
I'm trying to use it like this:
$context = \JsonLd\Context::create('lodging_business', [ 'name' => $this->row->title, ]);
but i cant get any output. What am i doing wrong?
The text was updated successfully, but these errors were encountered:
Where are you storing the new LodgingBusiness class?
Sorry, something went wrong.
It's in the ContextTypes Folder.
Looks like this:
<?php namespace JsonLd\ContextTypes; class LodgingBusiness extends AbstractContext { /** * Property structure * * @var array */ protected $structure = [ 'name' => null, 'description' => null, 'image' => null, 'areaServed' => null, 'priceRange' => null, 'telephone' => null, 'faxNumber' => null, 'email' => null, 'openingHours' => null, 'petsAllowed' => null, 'address' => PostalAddress::class, 'geo' => GeoCoordinates::class, 'url' => null, 'aggregateRating' => AggregateRating::class, 'review' => Review::class ]; /** * Set the opening hours of the business. * * @param array $items * @return array */ protected function setOpeningHoursAttribute($items) { return $items; } /** * Set the Reviews * * @param array $items * @return array */ protected function setReviewAttribute($items) { if ( ! is_array($items)) { return $items; } return array_map(function ($item) { return $this->getNestedContext(Review::class, $item); }, $items); } }
No branches or pull requests
I created a new ContextType file called
LodgingBusiness
. It looks like this:I'm trying to use it like this:
but i cant get any output. What am i doing wrong?
The text was updated successfully, but these errors were encountered: