24 lines
746 B
PHP
24 lines
746 B
PHP
<?php
|
|
|
|
namespace App\Component\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Reasons extends Model {
|
|
protected $table = 'reasons';
|
|
|
|
public static function getName($data) {
|
|
$reason_name = Reasons::where('code', intval($data))->where('is_history', 0)->first();
|
|
if ($reason_name) {
|
|
$reason_name = $reason_name['name'];
|
|
} else {
|
|
$reason_name = Reasons::where('code', intval($data))->where('is_history', 1)->first();
|
|
if ($reason_name) {
|
|
$reason_name = $reason_name['name'];
|
|
} else {
|
|
$reason_name = 'Связанная причина удаления не найдена';
|
|
}
|
|
}
|
|
return $reason_name;
|
|
}
|
|
} |