Actualizar usuarios
This commit is contained in:
@@ -27,6 +27,14 @@ class Usuario extends Model {
|
||||
protected $table = 'usuarios';
|
||||
protected $appends = ['roles'];
|
||||
|
||||
public static function findByIdOrAuth0Id($id) {
|
||||
if (str_starts_with($id, 'auth0')) {
|
||||
return Usuario::where('auth0_id', urldecode($id))->first();
|
||||
} else {
|
||||
return Usuario::where('id', $id)->first();
|
||||
}
|
||||
}
|
||||
|
||||
public function restaurantes() {
|
||||
return $this->belongsToMany(Restaurante::class, 'usuarios_restaurantes', 'usuario_id', 'restaurante_id');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user