mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 11:04:45 +02:00
Fix default timestamp for activity logs (#468)
* fix default timestamp for activity logs * fix phpstan
This commit is contained in:
parent
1c1c8c0cc6
commit
447e889a4f
@ -140,6 +140,10 @@ class ActivityLog extends Model
|
|||||||
{
|
{
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function (self $model) {
|
||||||
|
$model->timestamp = Carbon::now();
|
||||||
|
});
|
||||||
|
|
||||||
static::created(function (self $model) {
|
static::created(function (self $model) {
|
||||||
Event::dispatch(new ActivityLogged($model));
|
Event::dispatch(new ActivityLogged($model));
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('activity_logs', function (Blueprint $table) {
|
||||||
|
$table->timestamp('timestamp')->default(null)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('activity_logs', function (Blueprint $table) {
|
||||||
|
$table->timestamp('timestamp')->useCurrent()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user