feat: 项目基础框架+配置+Kernel

This commit is contained in:
testadmin
2026-04-29 05:35:00 +08:00
parent 6ce7adcbfb
commit 9a6151fce3
5082 changed files with 437062 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
/**
*
* hujinsuo01
* 继承此类可以创建此model的触发器
*
*/
namespace App;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
public static function boot() {
parent::boot();
$myself = get_called_class();
$hooks = array('before' => 'ing', 'after' => 'ed');
$radicals = array('sav', 'validat', 'creat', 'updat', 'delet');
foreach ($radicals as $rad) {
foreach ($hooks as $hook => $event) {
$method = $hook.ucfirst($rad).'e';
if (method_exists($myself, $method)) {
$eventMethod = $rad.$event;
self::$eventMethod(function($model) use ($method){
return $model->$method($model);
});
}
}
}
}
}