fix: update models and views

This commit is contained in:
Kwesi Banson Jnr
2026-07-20 12:17:25 +00:00
parent f2b2e9fe7a
commit b827b985e5
65 changed files with 1200 additions and 87 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class UserActivity extends Model
{
protected $guarded = array('id');
public $table = "user_activities";
// protected $appends = ['activity_time'];
public function userInfo(){
return $this->hasOne('App\Models\StaffMember', 'id', 'user_id');
}
public function userInfoSystem(){
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
}
public function getActivityTimeAttribute(){
$created = $this->created_at;
$parsed_created_date = Carbon::parse($created);
$current_date = Carbon::parse(date('Y-m-d'));
$days = $parsed_created_date->diffForHumans();
return $days;
}
}