*/
protected \$fillable = [];
/** @var array */
protected \$hidden = [];
/** @var array */
protected \$casts = [];
/** @var array */
protected \$dates = [];
/** @var array */
protected \$appends = [];
/** @var array */
protected \$with = [];
/** @var array */
protected \$touches = [];
/** @var array */
protected \$dispatchesEvents = [];
/**
|--------------------------------------------------------------------------
| Class Constants
|--------------------------------------------------------------------------
|
*/
//
/**
|--------------------------------------------------------------------------
| Custom/Private Methods
|--------------------------------------------------------------------------
|
*/
/**
* Get the prunable model query.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function prunable(): Builder
{
return static::where('deleted_at', '<=', now()->subMonth());
}
/**
* Prepare the model for pruning.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return void
*/
protected function pruning(): void
{
//
}
/**
* Get the value used to index the model.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return mixed
*/
public function getScoutKey()
{
return \$this->id;
}
/**
* Get the key name used to index the model.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return string
*/
public function getScoutKeyName(): string
{
return 'id';
}
/**
* Get the name of the index associated with the model.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return string
*/
public function searchableAs(): string
{
return 'models_index';
}
/**
* Get the indexable data array for the model.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return array
*/
public function toSearchableArray(): array
{
\$payload = \$this->toArray();
// modify here...
return \$payload;
}
/**
|--------------------------------------------------------------------------
| Accessors
|--------------------------------------------------------------------------
|
*/
/**
* An accessor.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute
*/
protected function attrName(): Attribute
{
return Attribute::make(
get: fn (\$value, \$attributes) => \$attributes['foo'],
set: fn (\$value, \$attributes) => \$attributes['foo'],
);
}
/**
|--------------------------------------------------------------------------
| Mutators
|--------------------------------------------------------------------------
|
*/
//
/**
|--------------------------------------------------------------------------
| Scopes
|--------------------------------------------------------------------------
|
*/
//
/**
|--------------------------------------------------------------------------
| Relationships
|--------------------------------------------------------------------------
|
*/
/**
* Something relationship.
*
* @package App\Models\Class
* @since 1.0.0
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function something(): BelongsTo
{
return \$this->belongsTo(
related: Something::class,
foreignKey: 'something_id',
);
}
]]>
laramodel