All Questions
2,882 questions
-1
votes
0
answers
36
views
Incomplete JSON body in Laravel request
I have a JSON object sent from Ajax to Laravel.
My Laravel project on windows with xampp receives the complete JSON and does not give any problem.
In production (Debian 11) the Laravel project ...
1
vote
1
answer
57
views
How to Seed Data from JSON Files in Laravel?
I have some JSON files, and I want to use them to seed my database in Laravel. Could someone guide me on how to achieve this? Specifically, I want to:
Migrate the database tables required for the ...
-1
votes
1
answer
70
views
Error “foreach() argument must be of type array|object” in laravel controller
During comments show in the post
Error “foreach() argument must be of type array|object” in laravel controller
The code is as under
Blade File
@foreach($comment->product_images as $image)
<a ...
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
0
answers
75
views
Cannot save captured image from webcam laravel 11 when using HTTPS
I am working on a project called "automatic face attendance system" that will detect users' faces, show information about the user, and save the captured image to a local server.
The process ...
0
votes
1
answer
52
views
Laravel's request data casted into string (should be integer)
I have this validation rules in request class:
public function rules(): array
{
$countries = getCountriesForValidation();
return [
'total_capital_cost' => 'required|integer|in:' . ...
1
vote
0
answers
29
views
Laravel AJAX/JSON Redirecting Issue
newbie here...
I'm trying to populate a form and table using json and ajax. The populating of the data seems working but I am being redirected to a black page with the data that I am trying to get.
...
0
votes
0
answers
139
views
Swift JSON Decoding Error After Server Migration: Expected String but Found Number
I've recently migrated my Laravel API to a new server, and since then, I've encountered a recurring JSON decoding issue on the iOS (Swift) side of my application. The error message I'm getting is:
...
0
votes
0
answers
30
views
Slack API list styling using PHP
I'm trying to send notification messages from my Laravel project's PHP controller to a slack channel. I am able to get it to send with a simple string, like so:
Http::post(
...
0
votes
0
answers
21
views
ResourceCollection does not implicitly transform each item in the collection using the corresponding resource class in Laravel
So I'm following the course: https://youtu.be/YGqCZjdgJJk?si=axa0ZDfO1BOxN-MO&t=1918 and I'm getting the following issue:
I have 2 resources in my Laravel app. The first is provided below
<?php
...
0
votes
0
answers
31
views
how to laravel join json format
sql query like this, My query works like this but how can I get a simpler output?;
$order_divided_piece = OrderDividedPiece::select('collection_color_size_barcode.*', 'order_divided_piece.*', '...
0
votes
1
answer
62
views
AJAX Patch Request returns empty in Laravel Controller [duplicate]
I am trying to update a resource in Laravel sending a PATCH request to my controller.
This is my AJAX call
$.ajax('profile', { // Replace with your actual endpoint URL
type: 'PATCH',
...
0
votes
0
answers
56
views
Sendcloud API-Laravel: malformed utf-8 characters, possibly incorrectly encoded
I am trying to create parcel on Sendcloud and I am getting error for street name with special characters: Moalleöandß xejuana n°41 2°4°.
Malformed utf-8 characters, possibly incorrectly encoded ...
0
votes
1
answer
92
views
How can I post array of objects like example
I have a problem with calling an API with Laravel.
I wont to call an api with a request like this (this is an example of json request):
{
"costCenterCode":"CDC-00070964",
&...
-1
votes
1
answer
578
views
Non-null assertions can only be used in TypeScript files.javascript
I've been working on this code base for the past month. And just yesterday, I started facing this problem on a few files. The code is supposed to change the div based on selected options. Here is the ...
0
votes
1
answer
66
views
How to modify a Laravel request when POST data is sent as `null`?
There are times when my front-end clients are sending null as the entirety of a request payload for a POST call:
Unfortunately, this is now causing an issue in my middleware:
JSON content was ...
-1
votes
1
answer
33
views
Laravel API with postman general error at 1364 Field
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error:
1364 Field 'user_id' doesn't have a default value
(Connection: mysql, SQL: insert into posts (post, updated_at,
created_at) values (...
0
votes
0
answers
203
views
SQLSTATE[22032]: <<Unknown error>>: 3140 Invalid JSON text: "Invalid value." at position 0 in value for column 'products.product_active_matterials'
I got this error while inputing data through form in my laravel project that some column in database having json datatype.
Below are my inputed value
and here is my table structure.
...
0
votes
0
answers
60
views
storing json list/array to MySQL with Laravel 11 api
I'm pretty new to laravel and I'm trying to find a better way to store a json list/array in mysql using the api. This is my current implementation of how I am able to get everything to work but I have ...
1
vote
0
answers
31
views
Laravel Query db table against date value this value may come from json meta->date or may depend on created at
I have some table called services which i store service records. i have a situation where i can add those services from 2 different places [ Reservation , POS ].
table structure for services table is ...
0
votes
0
answers
30
views
Elasticsearch filter. Laravel. Product-Property-Attribute
I have a Product model. He has a relationship with Property.
public function properties(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{
return $this->morphToMany(Property::class, '...
1
vote
2
answers
286
views
Issue with number formatting in Laravel controller
I am working with a Laravel controller where I am restricting the number of decimal places to 2. Here is an example:
$number = 123.456789; // Example number
// Format the number to 2 decimal places
$...
0
votes
0
answers
17
views
Lumen return Double values as string in Json [duplicate]
I'm using Lumen framework with a MySQL database.
I have two columns in my clients table:
name VARCHAR(100) NOT NULL
nb_part DOUBLE NOT NULL
I have one line in my table:
John ; 1.00
When I return ...
0
votes
1
answer
59
views
Laravel Delete record from Ajax Call - Button click event not working
I am trying to delete a record from ajax call in a laravel crud. But the click event seems not working. Therefore delete function is not working. Here is my code.
web.php
Route::delete('/categories/...
0
votes
0
answers
57
views
Installing Tailwind in Laravel project using Vite and NPM
I'm unsure what command to put in the dev script in package.json so that npm run dev works correctly. I'm trying to use Tailwind with Laravel.
All I want is to install Tailwind in my Laravel project ...
0
votes
2
answers
76
views
Auto fill object from json [duplicate]
I have a JSON:
{
"id":1,
"name":"John",
"firstname":"Doe"
}
Server side, I do it:
$input = $request->json()->all();
$user = new User();...
1
vote
1
answer
56
views
How can I make sure I get a JSON OK 200 response? Using Laravel and WooCommerce Webhooks (Wordpress)
Im trying to do a simple Webhook connection. I have setup my Wordpress database using Xampp and activated a webhook for whenever an order is created in the 'shop'. It works fine since I managed to ...
0
votes
1
answer
82
views
How to query with operators in JSON array column?
"Detail" column
[
{
"bedrooms_count" : 2,
"bathrooms_count" : 5
}
]
I want to query the records where bedrooms count >= 1 and <=5*.
This is the query ...
1
vote
2
answers
216
views
Undot Array with Wildcards in Laravel
In Laravel, I'm performing a JSON map where I need to transform a JSON to a different schema. To do that I'm following these steps:
Dot the array with Arr::dot helper. This way I have this result, ...
0
votes
0
answers
69
views
Your requirements could not be resolved to an installable set of packages. Problem 1 [duplicate]
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v11.0.0, ..., v11.0.8] require league/flysystem ^3.8.0 -> satisfiable by league/...
3
votes
2
answers
488
views
Display the Model's Repeater Field JSON Data on the Detail View in Laravel Nova
I'm using the repeater field on my resource which looks and works great for editing, but how do I display the json data it saves to my detail page? I assume I use the KeyValue field for displaying but ...
0
votes
0
answers
108
views
Data table refresh and pagination
i'm working on a simple crud data table, i add refresh function without reloading the page using ajax to append html. it works fine, then there's conflict when i add pagination from laravel. the table ...
1
vote
1
answer
146
views
How to use unicode characters in MariaDB JSON kolumn using Laravel
One of the attributes of my model is of type JSON. If I use Greek characters ('μ' etc.) in the JSON, they are automatically encoded in MariaDB as unicode characters (e.g. 'μ' is typed as '\03bc'). ...
2
votes
1
answer
85
views
Server does not return JSON
In development, the server returns JSON. But in production it does not return JSON. I found that in production, browser does not send X-Requested-With header.
In development - Note the X-Requested-...
0
votes
1
answer
104
views
Eloquent update json column with dot key
I can't find any information on how to properly update json values with dots in the key. Can you tell me where to clarify this information and how to do it? Is it possible to do this by means Eloquent?...
0
votes
0
answers
116
views
Customize Laravel API Pagination
I'm attempting to make my API match this response:
{
"data": [
{
"id": 1,
"name": "Emma Smith",
"avatar&...
0
votes
0
answers
39
views
How to create a JSON Object from a query in Laravel 10?
I need to return a JSON like this
`
{
"title": "Nueva noticia",
"category": "Deportes",
"body": "Nueva noticia de ...
-1
votes
2
answers
446
views
Laravel sending raw request body
I am trying to send an API request to the endpoint, and it is successful via Postman raw JSON, Now I am implementing the same in Laravel with HTTP facade.
Below is a POSTMAN screenshot with the ...
0
votes
1
answer
81
views
Laravel Import Large Json file to mySql
I am trying to import around 35MB file of JSON data to MySQL DB,
But after certain data import, it throws a timeout error,
Maximum execution time of 60 seconds exceeded
I have changed the php.ini ...
0
votes
1
answer
317
views
LARAVEL 5.7 JSONResource toArray ERROR: Declaration should be compatible
I have an problem using JSON Resource to Array converter in Laravel. My code like this:
DataResource.php
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\...
0
votes
0
answers
44
views
Laravel - Accessing JSON give "Trying to access array offset on value of type null" error
I am handling a response from Shopify
I am getting the error when I access the image array from response
Here is the JSON object
enter image description here
This is the main code.
enter image ...
0
votes
2
answers
1k
views
Laravel Method Illuminate\Http\JsonResponse::json does not exist, but only in specific use-case
I have a controller method which calls an external API and returns the result.
ControllerY -> getDataFromExternalAPI()
I call this controller method two different times in my app, in two distinct ...
1
vote
0
answers
91
views
Modify JSON output in Laravel
I want to remove some elements from my JSON output.
My Output is:
[
{
"current_page": 1,
"data": [
{
"_id": "...
0
votes
0
answers
311
views
GraphQL Query Error - Unexpected end of JSON input (Laravel - rebing / graphql-laravel)
I'm currently working on a GraphQL query that fetches a large dataset from my server. However, I'm encountering an "unexpected end of JSON input" error. This issue seems to be related to the ...
0
votes
1
answer
318
views
How to translate JSON api specific fields with translation stored in DB
I buid a live score website using Laravel and React template, I use an API to get live data with json format like this :
[
{
"country_id": "6",
"country_name": &...
0
votes
0
answers
84
views
Searching for nested data in JSON (Laravel)
"I want to create a filter where the data is taken from nested JSON."
Previously, I had a table named history_product with the column transaction_details. I want to create a filter based on ...
0
votes
1
answer
338
views
how to "destroy" and re-render the div that has foreach data in laravel livewire?
so, I have a livewire which the data come from json.gz. so it's not from model laravel. In this livewire, I need to make custom pagination, custom data form and so on.
So, I have this select option &...
0
votes
1
answer
363
views
Best practice for structuring JSON for models with foreign key relationships?
Hello!
I am working on a mono-repo using Laravel and VueJS, and it makes CRUD operations on tables containing foreign keys.
I'm finding it difficult to come up with a pattern or structure for my JSON. ...
0
votes
0
answers
177
views
Laravel 10: Get the full JSON API Response (not truncated)
I have integrated my app with a third-party app for payments, regarding successful payments the app is able to receive the complete API response (shared below) and also insert successfully into the ...
0
votes
4
answers
125
views
Laravel API Response should not contain index
I creates an API in which I am accepting this as JSON:
{
"productlist": [
{"student_id": 216, "product_id": 4, "product_qty": 2},
{"...