adding attribute accessor
This commit is contained in:
parent
1d50c81dc7
commit
89fd4b6ea3
@ -2,6 +2,7 @@
|
||||
<content><![CDATA[
|
||||
use App\Models\Traits\HasUidTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Prunable;
|
||||
|
||||
use HasUidTrait;
|
||||
@ -84,7 +85,19 @@ protected function pruning(): void
|
||||
|
|
||||
*/
|
||||
|
||||
//
|
||||
/**
|
||||
* An accessor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Casts\Attribute
|
||||
*/
|
||||
protected function attrName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value, $attributes) => $attributes['foo'],
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user