Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
How to request data from database in Laravel?

I've built a frontend in my vue3/laravel8 project and now want to get into the backend. I've been good at learning Vue3 but my knowledge base of Laravel is bare minimum.

I need to fetch an image link from a database and render it in a blade file.

In Vue3 I would use axios.get to send a request to a controller through an url and receive the image link. How do I send a request to my controller in Laravel? Is that even the right way to do it? I thought that maybe Laravel has some backend tricks up its sleeve, that Vue does not.

Edit:

I know that I can get data like this:

$data = DB::select('select * from db_name');

Does it have to be sent through an http response or can I just import the variable in the blade file?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Let's decompose your question to 2 sub-questions:

1- We need to fetch data when call axios request:

you have to update routes\api.php to link the coming request to the proper method located inside your controller

here's an example

2- We need to access our data in front-end:

Vue

  • If you using Vue components you can parse the response data then use it as you prefer

Laravel Blade System

  • You to call return view('your-blade-location', payload), payload => is your fetched data

here's a docs link

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda