Skip to content

Commit

Permalink
fix User Model
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny authored Sep 12, 2021
1 parent 6ac8d58 commit 2be34b5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

namespace Pharaonic\Laravel\Audits;

use App\Models\User;
use App\Models\Users\User;
use Illuminate\Support\Facades\Auth;

// use Illuminate\Database\Eloquent\Builder;

trait Auditable
{
/**
* Init Auditable Package
* Add `created_by`, `updated_by`, `deleted_at` fields to fillable list.
* Add `created_by`, `updated_by`, `deleted_by` fields to fillable list.
*
* @return void
*/
Expand All @@ -21,7 +19,7 @@ public function initializeAuditable()
array_push($this->fillable, 'created_by', 'updated_by');

if (is_bool($this->forceDeleting ?? null))
$this->fillable[] = 'deleted_at';
$this->fillable[] = 'deleted_by';
}

/**
Expand Down Expand Up @@ -62,7 +60,7 @@ protected static function bootAuditable()
*/
public function createdBy()
{
$model = config('auth.providers.users.model', User::class);
$model = config('auth.providers.users.model', config('auth.providers.users.model', User::class));
return $this->belongsTo($model, 'created_by');
}

Expand All @@ -71,7 +69,7 @@ public function createdBy()
*/
public function updatedBy()
{
$model = config('auth.providers.users.model', User::class);
$model = config('auth.providers.users.model', config('auth.providers.users.model', User::class));
return $this->belongsTo($model, 'updated_by');
}

Expand All @@ -80,7 +78,7 @@ public function updatedBy()
*/
public function deletedBy()
{
$model = config('auth.providers.users.model', User::class);
$model = config('auth.providers.users.model', config('auth.providers.users.model', User::class));
return $this->belongsTo($model, 'deleted_by');
}
}

0 comments on commit 2be34b5

Please sign in to comment.