This commit is contained in:
2020-12-01 17:23:13 -03:00
parent 09e8c226bb
commit 9852a8cbdc
274 changed files with 24706 additions and 0 deletions

34
app/Service/Register.php Normal file
View File

@ -0,0 +1,34 @@
<?php
namespace App\Service;
use Carbon\Carbon;
use Incoviba\common\Registry as RModel;
class Register
{
public static function log($user, $action, $variables)
{
$data = [
'user' => $user,
'action' => $action,
'time' => Carbon::now(config('app.timezone'))->toDateTimeString()//->format('Y-m-d HH:mm:ss')
];
$registry = model(RModel::class)
->where('user', $user)
->where('action', $action)
->where('time', $data['time'])
->findOne();
if (!$registry) {
$registry = model(RModel::class)->create($data);
$registry->save();
}
foreach ($variables as $data) {
$data['registry'] = $registry->id;
$log = (new Factory(RegistryData::class))->where($data)->find();
if (!$log) {
$log = model(RegistryData::class)->create($data);
$log->save();
}
}
}
}