first commit
This commit is contained in:
36
app/Models/Log/ActivityLog.php
Normal file
36
app/Models/Log/ActivityLog.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ActivityLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'activity_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'controllerName',
|
||||
'methodName',
|
||||
'actionUrl',
|
||||
'activity',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected $appends = ['user_name'];
|
||||
|
||||
public function getUserNameAttribute()
|
||||
{
|
||||
$user = User::find($this->user_id);
|
||||
return $user ? $user->name : '';
|
||||
}
|
||||
}
|
31
app/Models/Log/ErrorLog.php
Normal file
31
app/Models/Log/ErrorLog.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ErrorLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'controller_name',
|
||||
'method_name',
|
||||
'errors',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected $appends = [];
|
||||
|
||||
|
||||
}
|
37
app/Models/Log/LoginLog.php
Normal file
37
app/Models/Log/LoginLog.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LoginLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'login_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'ip',
|
||||
'user_agent',
|
||||
'type',
|
||||
'login_at',
|
||||
'logout_at',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected $appends = ['user_name'];
|
||||
|
||||
public function getUserNameAttribute()
|
||||
{
|
||||
$user = User::find($this->user_id);
|
||||
return $user ? $user->name : '';
|
||||
}
|
||||
}
|
40
app/Models/Log/OperationLog.php
Normal file
40
app/Models/Log/OperationLog.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OperationLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'operation_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'refNo',
|
||||
'user_id',
|
||||
'operation_start_no',
|
||||
'operation_end_no',
|
||||
'model_name',
|
||||
'model_id',
|
||||
'operation_name',
|
||||
'previous_values',
|
||||
'new_values',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
// protected $appends = ['operation_by'];
|
||||
|
||||
// public function getOperationByAttribute()
|
||||
// {
|
||||
// $user = User::find($this->user_id);
|
||||
// return $user ? $user->name : '';
|
||||
// }
|
||||
}
|
Reference in New Issue
Block a user