28 lines
616 B
PHP
28 lines
616 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 = Units::where('id', $unit_in_list['unit_id'])->first();
|
|
if ($unit_name) {
|
|
$unit_name = $unit_name['name'];
|
|
} else {
|
|
$unit_name = 'шт';
|
|
}
|
|
return $unit_name;
|
|
}
|
|
} |