wip
This commit is contained in:
25
app/Models/Concerns/HasSchemalessAttributes.php
Normal file
25
app/Models/Concerns/HasSchemalessAttributes.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user