1. Go to this page and download the library: Download bedoya/has-data 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/ */
bedoya / has-data example snippets
use Bedoya\HasData\Traits\HasData;
class Raffle extends Model
{
use HasData;
protected $casts = [
'data' => 'array',
];
}
$raffle->getData('grid.rows'); // returns 25
$raffle->getData('grid'); // returns [25, 40]
$raffle->setData('grid.cols', 40); // sets the value and optionally saves
$raffle->hasData('grid.rows'); // returns true