You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
783 B

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ViolationLaw extends Model
{
use HasFactory;
protected $table = 'violation_law';
protected $fillable = [
'code',
'display_name',
'type',
'sort',
];
public static function getTypeCodes()
{
$types = self::select('type')->distinct()->pluck('type')->toArray();
$typeCodes = [];
foreach ($types as $type) {
if ($type == 99 || $type== 3 || $type == 1) {
continue;
}
$codes = self::where('type', $type)->pluck('violationcode')->toArray();
$typeCodes[$type] = $codes;
}
return $typeCodes;
}
}