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.
41 lines
968 B
41 lines
968 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class AdminFloorRegion extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $table = 'admin_floor_region';
|
|
|
|
protected $hidden
|
|
= [
|
|
'created_at',
|
|
'updated_at',
|
|
'deleted_at'
|
|
];
|
|
|
|
/**
|
|
* @param int $floor_id
|
|
* @return array
|
|
*/
|
|
public static function getFloorRegion(int $floor_id): array
|
|
{
|
|
$columns = ['name'];
|
|
return self::query()->where('floor_id', $floor_id)->select($columns)
|
|
->get()->toArray();
|
|
}
|
|
|
|
public static function existsRoleMenu($floor_id, $nameArr): bool
|
|
{
|
|
$count = count($nameArr);
|
|
$existsCount = self::query()->where('floor_id', $floor_id)
|
|
->whereIn('name', $nameArr)->count();
|
|
return $count != $existsCount;
|
|
}
|
|
|
|
}
|
|
|