1. Go to this page and download the library: Download delgont/core 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/ */
delgont / core example snippets
// Example of storing properties in key-value way
$model = YourModel::create([
'name' => 'Example Model',
'description' => 'This is an example model',
'meta' => [
'key1' => 'value1',
'key2' => 'value2',
],
]);
// app/Models/YourModel.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Delgont\Core\Concerns\ModelHasMeta;
class YourModel extends Model
{
use ModelHasMeta;
protected $fillable = ['name', 'description', 'meta'];
}
// Example of using the trait to store key-value properties
$model = YourModel::create([
'name' => 'Example Model',
'description' => 'This is an example model',
'meta' => [
'key1' => 'value1',
'key2' => 'value2',
],
]);
// Accessing key-value pair
$model->setMeta('key3', 'value3');
$value = $model->getMeta('key3');