Files
postshop-backend/app/Models/Concerns/HasSchemalessAttributes.php
2026-02-03 15:31:29 +05:00

26 lines
535 B
PHP

<?php
namespace App\Models\Concerns;
use Illuminate\Database\Eloquent\Builder;
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
trait HasSchemalessAttributes
{
/**
* Add Schemaless Attributes to casts
*/
public function initializeHasSchemalessAttributes(): void
{
$this->casts['options'] = SchemalessAttributes::class;
}
/**
* Scope for Extra attributes
*/
public function scopeWithExtraAttributes(): Builder
{
return $this->options->modelScope();
}
}