1. Go to this page and download the library: Download phanan/poddle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* Get the instance as an array. All nested objects are also converted to arrays.
*/
public function toArray(): array;
/**
* Convert the object to its JSON representation.
*/
public function toJson($options = 0): string;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use PhanAn\Poddle\Values\Channel;
class ChannelCast implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes): Channel
{
return Channel::fromArray(json_decode($value, true));
}
/** @param Channel $value */
public function set($model, string $key, $value, array $attributes)
{
return $value->toJson();
}
}
use Illuminate\Database\Eloquent\Model;
class Podcast extends Model
{
protected $casts = [
'channel' => ChannelCast::class,
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.