Skip to content

Tag: laravel

Addition of an ordinal number in the Laravel Model

I am beginner webdeveloper, I use in my project Laravel 7 and maatwebsite/excel I have this code: This code generates an Excel document. It works fine. I would like to add a sequence number in 1 column (1,2,3 etc). How can I do this? My model: Please help Answer try this basically u need to add sn to heading …

Laravel query string into api call in routes

I have this route Sadly this doesn’t work I can reach the api with How can i replicate this in my route to work? Answer You got double }} there, try delete it so it will be like this: Edit: Add the route parameter to API function parameters

Dynamically add empty index to array based on default indexes

I have below array, which includes a set of default indexes, that must be present in my final array: The above array is saved in a variable called $entities. Now, I have a 3rd party API, that will return the above entities, but only include them in the response if the entity contains a value. For example, a $…

Laravel store multiple just saves one

I am sending array of data to controller but it only saves 1 row to database, I need to save multiple rows (depend on array length). Code controller Screenshot request data stored data any idea? Answer Move $transit = new Transit; inside the foreach, and end the foreach loop right before returning the respons…