'datetime', 'settings' => 'array', ]; public function passwordSecurity() { return $this->hasOne(PasswordSecurity::class); } public function teams() { return $this->belongsToMany(Team::class, TeamUser::class); } public function scopeByTeam($query, $id) { return $query->whereHas('teams', function ($query) use ($id) { $query->where('id', $id); }); } public function scopeByUniqueTeam($query) { return $query->has('teams', '=', 1); } public function scopeActive($query) { return $query->where('active', 1); } }