-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class StaffActionLog extends Model | ||
{ | ||
protected $table = 'staff_action_log'; | ||
|
||
use HasFactory; | ||
|
||
protected $fillable = ['user_id', 'target_id', 'action', 'message']; | ||
} |
34 changes: 34 additions & 0 deletions
34
database/migrations/2023_08_15_231718_create_staff_action_log.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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::create('staff_action_log', function (Blueprint $table) { | ||
$table->id(); | ||
$table->unsignedBigInteger('user_id'); // ID of the user who is performing the action | ||
$table->unsignedBigInteger('target_id'); // ID of the user being acted upon | ||
$table->string('action'); // e.g., 'ban', 'remove_avatar' | ||
$table->string('message')->nullable(); // e.g., 'removed avatar 456845967.png for user username (ID: 398)' | ||
$table->timestamps(); | ||
|
||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); | ||
$table->foreign('target_id')->references('id')->on('users')->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('staff_action_log'); | ||
} | ||
}; |