Files
admin-php-module/models/Units.php
miroman-afk c4dc6e02a0 v.2.30
Добавлен расширенный отчет по реализации
Добавлен монитор активности
2023-08-03 11:05:15 +03:00

28 lines
615 B
PHP

<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class Units extends Model
{
protected $table = 'units';
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
public static function getName($data)
{
$unit_in_list = UnitsList::where('id', $data)->first();
$unit_name = self::where('id', $unit_in_list['unit_id'])->first();
if ($unit_name) {
$unit_name = $unit_name['name'];
} else {
$unit_name = 'шт';
}
return $unit_name;
}
}