mercredi 25 mai 2016

Using concat in laravel

iam trying to give url to my image, so i try to use concat. but in there i have trouble if the concat just use to 1 column i can make it. but is use 3 column, so i dont now how to do it ?

this is my controller :

$site = asset("uploads").'/';
        $result = DB::table('log_patrol_details')
        ->select("*",DB::raw("concat('$site',photo1) as photo1"))
        ->where('id_log_patrols', $request->input('id_log_patrols'))
        ->orderBy('id', 'desc')
        ->first();
        if(count($result)==0) {
            $response['api_status'] = 0;
            $response['api_message'] = "Belum ada data";
        }else{
            $response['api_status'] = 1;
            $response['api_message'] = "success";
            $response['items'] = $result;
        }
        return response()->json($response);

iam try to add concat to my photo1, photo2, and photo3

image



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire