1. Go to this page and download the library: Download bauerdot/laravel-dbml 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/ */
class Broker extends Model
{
protected $casts = [
'permanent_address' => AddressValueObject::class,
'contact_address' => AddressValueObject::class
];
}
class AddressValueObject extends Data
{
public function __construct(
public readonly ?string $city,
public readonly ?string $street,
public readonly ?string $country,
public readonly ?string $zip,
public readonly ?string $houseNumber,
public readonly ?string $district = null,
public readonly ?string $referenceNumber = null
) {}
}
bash
# Parse only the 'users' and 'posts' tables
php artisan dbml:parse --only=users,posts
# Parse tables that match a pattern
php artisan dbml:parse --only="user_*"
# You can also specify multiple --only options
php artisan dbml:parse --only=users --only=posts
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.