mardi 11 août 2020

Laravel remove backslashes from JSON response in Restful API

I'm building a restful api and i'm trying to pass image URL that stored in database

for example, when i'm trying to pass this link to api 127.0.0.1:8000/images/123.jpg it appearances like 127.0.0.1:8000\/images\/123.jpg

i tried things like stripslashes() but nothing works

Controller

public function companiesAll()
{
    $companies = Company::where('status',1)->select('id', 'name',"image")->get();

        return response()->json([$companies]);
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire