first commit

This commit is contained in:
root
2025-06-18 10:31:43 +08:00
commit d9f820b55d
981 changed files with 449311 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace App\FormModel\admin\articles\trait;
use App\Model\AppArticle;
trait ModifyForUpdate
{
protected array $canUpdateFields = ['title', 'cover', 'images', 'brand', 'location'];
public function update()
{
$query = AppArticle::where(['aid' => $this->attributes['aid']])->first();
foreach ($this->canUpdateFields as $field) {
$val = $this->attributes[$field] ?? null;
if ($val !== null) {
$query->{$field} = $this->attributes[$field];
}
}
$query->save();
}
}