diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 6619a4b2b..6842c2959 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -11,6 +11,11 @@ class Contact extends Model use HasFactory; use SoftDeletes; + public function resolveRouteBinding($value, $field = null) + { + return $this->where($field ?? 'id', $value)->withTrashed()->firstOrFail(); + } + public function organization() { return $this->belongsTo(Organization::class); diff --git a/app/Models/Organization.php b/app/Models/Organization.php index 7eade38a4..6ee084b4c 100644 --- a/app/Models/Organization.php +++ b/app/Models/Organization.php @@ -11,6 +11,11 @@ class Organization extends Model use HasFactory; use SoftDeletes; + public function resolveRouteBinding($value, $field = null) + { + return $this->where($field ?? 'id', $value)->withTrashed()->firstOrFail(); + } + public function contacts() { return $this->hasMany(Contact::class); diff --git a/app/Models/User.php b/app/Models/User.php index 1c6fc2d6f..4dfaac671 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -19,6 +19,11 @@ class User extends Authenticatable 'email_verified_at' => 'datetime', ]; + public function resolveRouteBinding($value, $field = null) + { + return $this->where($field ?? 'id', $value)->withTrashed()->firstOrFail(); + } + public function account() { return $this->belongsTo(Account::class);