Skip to main content

All Questions

Tagged with
-1 votes
1 answer
77 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 ...
software dev's user avatar
0 votes
1 answer
322 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\...
Merry Ricard's user avatar
0 votes
0 answers
354 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": [...
John O's user avatar
  • 5,403
0 votes
0 answers
54 views

Null response instead huge JSON in Laravel 5.6

I'm working on a project written in Laravel 5.6 and I need to return a huge JSON (close to 5MB). It contains two keys: hasMore (bool) and data (rendered view). I debugged it (via dd()) and everything ...
Q_Nick's user avatar
  • 61
0 votes
1 answer
178 views

Ajax response is not returning in sorted form laravel controller

I am fetching data from database then adding one more property to that object which is distance. and sorting object data based on that property. When I dd() it in controller to check if data is sorted ...
user avatar
0 votes
1 answer
439 views

Store data into database using request json string in laravel

I am having a table name Student ( id , name , division ). To store data into this table I am sending json string as a request to the api in laravel. Request json string is, { "name":"...
Androing's user avatar
0 votes
1 answer
253 views

Proper way of using Laravel Collect for creating combination

I am trying to create combination from the below list, but I am not sure how to parse through the results as the results dynamicaly changes each time. Here is the result I receive through my form, {&...
mightyteja's user avatar
0 votes
1 answer
888 views

Laravel remove backslashes from JSON response in Restful API

I'm building a restful api and i'm trying to pass image URL that stored in database for example, when i'm trying to pass this link to api 127.0.0.1:8000/images/123.jpg it appearances like 127.0.0.1:...
Jimmy Phill's user avatar
0 votes
1 answer
807 views

In Laravel, how can i return a specific *column* from a *table* inside my API Controller ? I'm using Laravel 5

Question How can i return a specific column from a table [within the API Controller] ? I used pluck but it removed the column name from the output. I need the column name to be included as well. The $...
Adrian Karr's user avatar
3 votes
1 answer
3k views

How to get join results as an array of objects in Laravel?

I have been working on a personal project where users can rate different shops. Among many, I have two tables schemas that I am working on. Table: Shops id shop_name user_id (shops belongs to a user) ...
gitam gadtaula's user avatar
2 votes
0 answers
165 views

How to create a json file from chunks of data

i have a 5000 rows in the database and trying to get the data as chunks and create one json file that contain all the 5000 rows, my code ManagerFacade::findAllAsChunks(function ($timeSignals) { ...
Fadi's user avatar
  • 2,370
1 vote
1 answer
3k views

Laravel Create Order using API

I'm building an API for e-commerce app now, i get stuck in creating order i have the following Migrations Orders Schema::create('orders', function (Blueprint $table) { $table->id(); ...
user avatar
0 votes
0 answers
1k views

Yajra Datatable return Invalid JSON response

I use Yajra Datatable in my Laravel Project . I created my DataTable with it and it works correctly for me. But sometimes it gives me the error that by refreshing the page a few times this error will ...
ali dehqani's user avatar
0 votes
0 answers
72 views

Laravel: Sending JSON in post request

I am making a post request and tested it in Postman with the raw body data as: { "fields":{ "summary":"Testing", "issuetype":{ "id":"10039", "type":"Task" ...
raulInsto's user avatar
0 votes
1 answer
122 views

How would I decode this JSON to insert into a json column? ErrorException: Object of class stdClass could not be converted to string in file

What would be the proper way to decode this json? my model has protected $casts = [ 'items' => 'array' ]; my json items: { "data": [ { "name": "Google", "...
Mike Shiv's user avatar
  • 223

15 30 50 per page
1
2 3 4 5
20