Files
admin-php-module/models/Printer.php
miroman-afk fb46c8e739 v.2.27
Fixed reports
2023-05-02 15:21:54 +03:00

31 lines
821 B
PHP

<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class Printer extends Model {
protected $table = 'printers';
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
public static function getName($data) {
$printer_name = Printer::where('code', $data)->where('is_history', 0)->first();
if ($printer_name) {
$printer_name = $printer_name['name'];
} else {
$printer_name = Printer::where('code', $data)->where('is_history', 1)->first();
if ($printer_name) {
$printer_name = $printer_name['name'];
} else {
$printer_name = 'Связанный принтер удален';
}
}
return $printer_name;
}
}