45 lines
919 B
PHP
Executable File
45 lines
919 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DogOption extends Model
|
|
{
|
|
protected $table = 'dog_option';
|
|
public $timestamps = false;
|
|
|
|
public static function _hit($sThisName, $k)
|
|
{
|
|
$v = self::where("dog_name", $sThisName)->where("k", $k)->first()?->v;
|
|
|
|
return $v;
|
|
}
|
|
|
|
public static function _list($sThisName)
|
|
{
|
|
$oSelf = self::where("dog_name", $sThisName)->get();
|
|
|
|
return self::_filterList($oSelf);
|
|
}
|
|
|
|
public static function _filter($oOption)
|
|
{
|
|
$arr = [];
|
|
$arr[$oOption->this_name."#".$oOption->k] = $oOption->v;
|
|
|
|
return $arr;
|
|
}
|
|
|
|
public static function _filterList($oOption)
|
|
{
|
|
$arr = [];
|
|
foreach ($oOption as $oOptionRow) {
|
|
$arr[] = self::_filter($oOptionRow);
|
|
}
|
|
|
|
return $arr;
|
|
}
|
|
|
|
}
|