PHP code example of a1dbox / laravel-model-accessor-builder
1. Go to this page and download the library: Download a1dbox/laravel-model-accessor-builder 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/ */
a1dbox / laravel-model-accessor-builder example snippets
use A1DBox\Laravel\ModelAccessorBuilder\Concerns\HasAccessorBuilder;
class User extends Model
{
use HasAccessorBuilder;
}
class User extends Model
{
use HasAccessorBuilder;
public function getFullNameAttribute()
{
return AccessorBuilder::make(
fn (AccessorBuilder\BlueprintCabinet $cabinet) => $cabinet->trim(
$cabinet->concat(
$cabinet->col('name'),
$cabinet->str(' '),
$cabinet->col('last_name'),
)
),
);
}
}