发布推送

This commit is contained in:
ROmani
2024-02-26 00:41:25 +08:00
parent 70304f730b
commit 1a9008b318
33 changed files with 1515 additions and 216 deletions

View File

@ -32,14 +32,16 @@ class BaseModel extends Model
return $this->newQuery()->where($this->primaryKey, $id)->delete();
}
function updateItem($aItem): bool|int
function updateItem($aItem,$col = null): bool|int
{
if(!$col) $col = $this->primaryKey;
$aItem = $this->checkColInFill($aItem);
if (empty($aItem)) return false;
if (isset($aItem[$this->primaryKey])) return false;
return $this->newQuery()->where($this->primaryKey,$aItem[$this->primaryKey])->update($aItem);
if (isset($aItem[$col])) return false;
return $this->newQuery()->where($col,$aItem[$col])->update($aItem);
}
function findItem($id,$col=['*']): Model|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Builder|array|null
{
return $this->newQuery()->find($id,$col);