I want to get array in database,it work in database query (my database i use postgrest) but not work in my project laravel. Error message -> Undefined column: 7 ERROR: column sample1.text[1] does not exist
table sample1
___________________________________
| id | name | text[] |
|------+------+--------------------|
| 1 | aa | {xxx1,xxx2,xxx3} |
| 2 | bb | {xxx1,xxx2,xxx3} |
| 3 | cc | {xxx1,xxx2,xxx3} |
|______|______|____________________|
I need value
{
xxx1,
xxx1,
xxx1
}
my code
$search = DB::table("sample1")->select(array( 'sample1.text[1]'))->get();
return response()->json($search);
in my database query it work
SELECT "NSO_STAT_GIS"."BND_SET_STAT_TABLE"."MAPTB_CAT_SL_ID"[1] FROM "NSO_STAT_GIS"."BND_SET_STAT_TABLE"