69 lines
1.7 KiB
PHP
Executable File
69 lines
1.7 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* SysCMS - Content Management System
|
|
*
|
|
* Copyright (c) 2026 Marco Costa
|
|
* All rights reserved.
|
|
*
|
|
* Author: Marco Costa
|
|
* Email: contato@syspanel.com.br
|
|
* Project: SysCMS
|
|
*
|
|
* This software is licensed, not sold.
|
|
* Permission is granted to use this software
|
|
* subject to the terms of the SysCMS Commercial License.
|
|
*
|
|
* Redistribution, sublicensing, resale, or
|
|
* disclosure of this software, in whole or in part,
|
|
* is strictly prohibited without prior written permission.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
|
*/
|
|
|
|
namespace Modules\GlobalLists\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Activity
|
|
*
|
|
* Model representing a global business activity or category.
|
|
* Supports multi-language names stored in a JSON field.
|
|
*
|
|
* @package Modules\GlobalLists\Models
|
|
* @property int $activities_id
|
|
* @property array $activities_name JSON array of names in different locales
|
|
* @property string $activities_slug URL-friendly slug
|
|
* @property string $activities_type Type of activity (commercial, industrial, etc.)
|
|
*/
|
|
class Activity extends Model
|
|
{
|
|
protected $table = 'lists_activities';
|
|
protected $primaryKey = 'activities_id';
|
|
protected $fillable = [
|
|
'activities_name',
|
|
'activities_slug',
|
|
'activities_type'
|
|
];
|
|
|
|
protected $casts = [
|
|
'activities_name' => 'array'
|
|
];
|
|
|
|
/**
|
|
* Get the translated name.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getNameAttribute()
|
|
{
|
|
$names = $this->activities_name;
|
|
if (is_array($names)) {
|
|
$locale = \Kernel\Translator::getLocale() ?: 'pt_BR';
|
|
return $names[$locale] ?? $names['pt_BR'] ?? array_shift($names);
|
|
}
|
|
return $names;
|
|
}
|
|
}
|