All Questions
29 questions
0
votes
0
answers
26
views
How to handle unicode in postgresql query in Laravel [duplicate]
I have a table in my application that shows the jobs in queue. I want it to be possible to order the jobs by the uuid that is found within the payload of the Laravel jobs table. The problem is with ...
0
votes
1
answer
600
views
How to import a JSON column in Laravel Excel
I'm trying to import a file that contains json data in some columns and this data needs to be imported into JSONB fields in PostgreSQL.
Json data example:
{"phone":"6365615298", &...
1
vote
1
answer
399
views
Laravel postgres db return string instead int or float values
We are working on the migration of a very large project with laravel and a postgres database, unfortunately for many queries we have to use them raw because they draw from currently existing postgres ...
0
votes
0
answers
352
views
Correct setup for a Laravel resource of a jsonb column?
I have a jsonb column in Postgres that I'm trying to make use of with Laravel. When the resource itself is returned (rest, etc), the value for that column is returned null:
{
"content": [...
1
vote
2
answers
2k
views
How to query whereIn inside json column in laravel 5.3?
I have been working with a laravel 5.3 version and in a table i have a json column where i have saved average rating of a category table.
so, A product category table has a column "detail" ...
1
vote
1
answer
119
views
Converting raw laravel mysql json query into postgres syntax
I have the following query that works in MYSQL
$query->whereRaw('
ST_Distance_Sphere(
point(address->>"$.longitude", address->>"$.latitude"),
point(?,...
0
votes
0
answers
60
views
Why is one function returning an array and the other one an object in Laravel
I have two Laravel functions that use Eloquent to retreive information from the DB(Postgres) which are virtually the same except that the where in one is a greater or equal than and the other one is ...
0
votes
1
answer
494
views
How to CAST field from JSON column with Laravel Eloquent(POSTGRESQL)?
How I can change type of field in Json column column->field->value If type is string I have to change it on INT.
1
vote
1
answer
338
views
How can I compare field from JSONB column in Laravel?
I have a column with type JSONB(postgresql), and I need in checking of one field of this JSON structure. For example data->vegetables->tomato->weight->value >= "12". I used ...
-1
votes
1
answer
134
views
Search by JSON field not working in Laravel
This is "tags" field as json in products table:
[{"id":1,"name":"Adidas","slug":"adidas"},{"id":2,"name":"Nike"...
0
votes
3
answers
372
views
Convert array of formatted strings into an array of arrays
How to convert an array from a Postgres query to array variable in Laravel?
My
I have result var_dump from Laravel:
0 => array:1 [
"order_itemset" => "{8,11}"
]
1 =>...
1
vote
0
answers
241
views
how to convert json string column to integer in where query postgres in laravel
I have $services = CitizenService::with('service_status');
and I will do filter by json data
$services=$services->where('data->unikal_id', '>=', 1)->where('data->unikal_id', '<=', ...
0
votes
1
answer
1k
views
Joining Table Laravel Combined with JQuery and AJAX request
i want to join some of tables and getting the data to display into datatables, i'm recently using yajra datatables.
Here list of tables that i want to join :
ekspedisis : id, client_id, org_id, ...
0
votes
1
answer
2k
views
How to use Postgres jsonb '?' operator in Laravel with index support?
I'm trying to use the jsonb exists operator '?' in Laravel's query builder, and have it use an index, but I've run into some issues.
Sample query
DB::table('table_name')->whereRaw("jsonb_column ? ...
0
votes
1
answer
347
views
How to update json data in postgresql database using laravel?
how to change next data in database:
jsonData = [{"given_date": "2 1.05. 2002 year"}]
to
jsonData = [{"given_date": "21.05.2002"}]
0
votes
1
answer
231
views
Laravel update json column in postgresql
In postgresql db I have a column type json call it "activities". I would like to add there new (key -> value) pair. Without delete existing data.
At this moment my code look like this:
$user = User::...
1
vote
3
answers
6k
views
How to search in a json field that contains an array of objects with Eloquent
I'm trying to seach in JSON field with Eloquent, but now work, seach with 0 results.
This is for Ubuntu server, running PostgresSQL, Laravel 5.8 and Apache 2.
[{
"value": "1",
"label": "...
1
vote
2
answers
448
views
How can I convert postgres database to JSON file?
I'm working on flutter mobile application which should be attached (connected) with the web platform that I developed with laravel, I want to generate JSON file from Postgres dynamically , I mean when ...
0
votes
2
answers
67
views
Query on jsonb array
I have this kind of json array and i want to check stringValue inside value array is null or not plus i want to check it with its id and fielddata is column name
[
{
"name": "...
0
votes
0
answers
267
views
Not able to fetch data while querying on Array of Json Objects in Laravel Postgresql
I am trying to get all records whose id matches the given value.
Laravel Version: laravel/framework: "5.7.*"
PHP Version: php: ^7.1.3"
psql -V: psql (PostgreSQL) 11.1 (Ubuntu 11.1-1.pgdg16.04+1)
...
0
votes
1
answer
4k
views
Update json data in laravel 5.6
Problem: Need to update json data in address names field.
bookcontroller:
public function edit(Book $book)
{
return view('books.edit',compact('book'));
}
public function update(Request $request, ...
0
votes
1
answer
265
views
Trouble Parsing Entire Laravel/Eloquent Collection's JSONB PostgreSQL Table Column
I have a PostgreSQL table that stores articles for a simple Laravel CRUD/CMS application. The PostgreSQL table also has a JsonB column to store each piece of an individual article (title, image url, ...
0
votes
1
answer
673
views
Finding multiple column average of the average of values in SQL json column
Say I have a database with data in the following format
| id | name | rating |
-----------------------------------------------------------------|
| 1 | ...
2
votes
1
answer
2k
views
Displaying JSON Data From Postgres WIth Laravel Blade
I have a postgres database, and it has a table with two columns ('id' which is the primary key, and 'data', which is storing a JSONB dataset that has title, content, etc.).
Currently, I can only show ...
0
votes
1
answer
717
views
Where query Json (Array) column in laravel
I wanna do following code snap:
DB::table('tests')->whereIn('words', ['school','running'])->get();
using postgresql and 'words's type is jsonb
In words table data, like following.
['someword',...
0
votes
1
answer
493
views
How to get PostgreSQL's JSON type data in laravel?
I created table
-- Table: public.books
-- DROP TABLE public.books;
CREATE TABLE public.books
(
id integer,
data json
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.books
OWNER TO postgres;
-- ...
0
votes
1
answer
137
views
Search column of JSON data in PostgreSQL table
I need to store some JSON data in PostgreSQL table to use it as dynamic route generator. The migration is simple:
Schema::create($this->tablename, function (Blueprint $table)
{
$table->...
1
vote
2
answers
3k
views
Use Postgres features like JSON functions in Laravel
Postgresql has some function and operations for using JSON data. As it describes in postgresql site, it's possible to save JSON data in a column and get JSON array element with -> operator. Everything ...
2
votes
0
answers
933
views
What is the SQL injection likelihood on a raw PostgreSQL JSON field query?
I'm starting to build an API using Laravel with PostgreSQL as the data source. From what I've read so far, Laravel's Eloquent ORM currently does not support querying indexed JSON (April 2014). For ...