Documentacion de la api en el readme
This commit is contained in:
@@ -32,7 +32,7 @@ class UsuariosController extends Controller {
|
||||
|
||||
return response()->json([
|
||||
'pagination' => $paginate,
|
||||
'data' => array_values(Usuario::all()->skip($paginate['from'] - 1 )->take($paginate['per_page'])->all())
|
||||
'data' => array_values(Usuario::with('restaurantes')->skip($paginate['from'] - 1 )->take($paginate['per_page'])->get()->all())
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ use App\Services\Auth0Service;
|
||||
use App\Traits\UuidPrimaryKey;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use phpDocumentor\Reflection\Types\Boolean;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class Usuario
|
||||
@@ -40,9 +40,14 @@ class Usuario extends Model {
|
||||
*/
|
||||
public static function findByIdOrAuth0Id($id) {
|
||||
if (str_starts_with($id, 'auth0')) {
|
||||
return Usuario::where('auth0_id', urldecode($id))->first();
|
||||
return Usuario::where('auth0_id', urldecode($id))->with('restaurantes')->first();
|
||||
} else {
|
||||
return Usuario::where('id', $id)->first();
|
||||
try {
|
||||
return Usuario::where('id', $id)->with('restaurantes')->first();
|
||||
} catch (QueryException $ex) {
|
||||
Log::warning('Se intento obtener un usuario con un id invalido', ['id' => $id]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user