reconstruction of the project
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class AuthorizedUser extends Model
|
||||
class AuthorizedUser extends BaseModel
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'authorized_users'; // Table name
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = true;
|
||||
protected $table = 'authorized_users';
|
||||
|
||||
// ✅ auto-manage created_at / updated_at
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'authorized_user_id',
|
||||
@@ -26,24 +26,22 @@ class AuthorizedUser extends Model
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
// Laravel manages created_at + updated_at automatically
|
||||
public $timestamps = true;
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
'authorized_user_id' => 'integer',
|
||||
'email' => 'string',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
'phone_number' => 'string',
|
||||
'relation_to_user' => 'string',
|
||||
'token' => 'string',
|
||||
'status' => 'string',
|
||||
];
|
||||
|
||||
// Relationship: Each authorized user belongs to a user
|
||||
/* =========================
|
||||
* Relationships (optional)
|
||||
* ========================= */
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
||||
public function authorizedUser()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'authorized_user_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user