39 lines
875 B
PHP
39 lines
875 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SettingsCatalogDefinition extends Model
|
|
{
|
|
protected $fillable = [
|
|
'definition_id',
|
|
'display_name',
|
|
'description',
|
|
'help_text',
|
|
'category_id',
|
|
'ux_behavior',
|
|
'raw',
|
|
];
|
|
|
|
protected $casts = [
|
|
'raw' => 'array',
|
|
];
|
|
|
|
/**
|
|
* Find a definition by its definition_id.
|
|
*/
|
|
public static function findByDefinitionId(string $definitionId): ?self
|
|
{
|
|
return static::where('definition_id', $definitionId)->first();
|
|
}
|
|
|
|
/**
|
|
* Find multiple definitions by their definition_ids.
|
|
*/
|
|
public static function findByDefinitionIds(array $definitionIds): \Illuminate\Support\Collection
|
|
{
|
|
return static::whereIn('definition_id', $definitionIds)->get()->keyBy('definition_id');
|
|
}
|
|
}
|