php - Using concat in laravel -
iam trying give url image, try use concat. in there have trouble if concat use 1 column can make it. use 3 column, dont how ?
this controller :
$site = asset("uploads").'/'; $result = db::table('log_patrol_details') ->select("*",db::raw("concat('$site',photo1) 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 add concat photo1, photo2, , photo3
i'm not sure i've understood question. can't add 2 more statements select photo2
, photo3
, you're go?
->select("*", db::raw("concat('$site',photo1) photo1"), db::raw("concat('$site',photo2) photo2"), db::raw("concat('$site',photo3) photo3") )
Comments
Post a Comment