1. Go to this page and download the library: Download kolyayurev/voyager 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/ */
public function setOptionsAttribute($value)
{
$this->attributes['options'] = json_encode($value);
}
public function getOptionsAttribute($value)
{
return json_decode(!empty($value) ? $value : '{}');
}
public function setMeta1Attribute($value)
{
$this->attributes['options'] = collect($this->options)->merge(['meta_1' => $value]);
}
public function getMeta1Attribute()
{
return $this->options->meta_1 ?? null;
}
public static function boot(){
parent::boot();
static::creating(function ($model) {
$model->type = 'client';
});
static::addGlobalScope('client', function($builder){
$builder->where('type', 'client');
});
}