theprodev's avatar

Hello How to get and show uploaded image Throw Api http request

any one can tell me the steps i tasted like that but dosent work

// Api.php

Route::get('/slider', 'FrontendController@slider')->name('slider');

// method

public function slider() { $slider = Slider::latest() ->first(); return response()->json([ 'slider' => $slider ]);

}

// Migration Schema::create('sliders', function (Blueprint $table) { $table->increments('id'); $table->string('slider_img1'); $table->string('slider_img2'); $table->string('slider_img3'); $table->string('slider_img4'); $table->timestamps(); });

I'm using angular6

// request look like return this.http.get('http://127.0.0.1:8000/api/slider').subscribe( data => console.log(data), err => console.log(err) );

// http response

{slider: {…}} slider: created_at: "2018-10-18 00:19:00" id: 1 slider_img1: "sliders\October2018\toroVP20j5hcp4wv6aXR.jpg" slider_img2: "sliders\October2018\taT0TcpcLqHwSrbPQfZD.jpg" slider_img3: "sliders\October2018\9xZ9ztoCbjAuO03kzE2S.jpeg" slider_img4: "sliders\October2018\935jhI1osz6vsls0Ul6U.jpeg" updated_at: "2018-10-18 00:19:00" proto: Object proto: Object

// in template

img src="/storage/sliders\October2018\toroVP20j5hcp4wv6aXR.jpg" />

Nothing Show console say

// what is the correct path

//console say image not found

// note already did command php artisan link:storage

0 likes
0 replies

Please or to participate in this conversation.