mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 17:37:23 +08:00
custom fields add priority + display
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class SearchBox extends NexusModel
|
||||
{
|
||||
protected $table = 'searchbox';
|
||||
@@ -33,6 +35,21 @@ class SearchBox extends NexusModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getCustomFieldsAttribute($value): array
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
return explode(',', $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function setCustomFieldsAttribute($value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$this->attributes['custom_fields'] = implode(',', $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Category::class, 'mode');
|
||||
|
||||
Reference in New Issue
Block a user