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 …
Tag: laravel
Host laravel application inside laravel application
I am trying to host a laravel inside a laravel application because I need it to work on the same domain. So imagine my domain is somedomain.com. I am already pointing it to the public directory of a …
How to define a user (author) – OctoberCMS
I need help. I only need to be able to view one user for a post in OctoberCMS. But all users will always show up to me. Here’s the code that works, but I don’t know how to define it to work the way I …
Detecting an object containing all empty string property values in php or laravel
I need to detect if an object’s (like the below one) all the properties has an empty string as value. How can I achieve this? Answer Since it is all empty strings/null these fields can be filtered out easily: If it has a single property that isn’t a “falsey” value you will get true. FY…
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 how to check if at least one column value is true or false
How can I check, if at least one of a bunch of checkboxes is checked/true? I’m using Laravel 5.8 My query right now: So far this works, but “only” returns an array with each value. Like this: I need some kind of value that tells me : is-checked: true/false – something like that. How ca…
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…
Laravel : SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘files’ in ‘field list’
I’m trying to nake a simple to save a simple Product in my db but for a reason I don’t understand, I get this error each time I try to save. SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘…
(Laravel) Change Nova Resource name? (only on interface)
I’m trying to change the display name of one Nova resource, without change the name from de database that it references. Only for View / interface purposes. I checked the AppNova*myResource*.php file and find this variable: But after change this the same old name still appears. Anyone knows how to resol…