Laravel Json array data display blade file - laravel

I have three column with different data. every column store data in json format, but now i want to display them, but its not working: Bellow my code:
Response:
"[{"type":"pllet-a","price_km":50,"size":28000,},{"type":"pellet-b","price_km":40,"size":20000,}]"
I want to display only value Example (50 km) in foreach loop. What is the way to fix it into laravel blade file. I have tired json_decode but not working.

Related

Laravel Excel: Store csv file only if array data is not empty

I'm using Laravel Excel in a project, and I want to store the data as CSV only if there is data. Unfortunately, LaravelExcel array method needs to return an array, and if the result is empty, it creates a file with the given file name without content. So I want to make the file only if there is data. Here is how I used it:
Excel::store(new Foo(), 'filename', 'storage_disk');

How to extract value based on the header OR how to extract headers value from ods file in Ruby?

Want to extract values under "Location" header.
EDIT: —-following extracted from following comments. It originally appeared this was a web related thing, but no, the OP is dealing with a spreadsheet, not a web page.)—-
This is an excel sheet and I want to extract the table values based on the header.
For Example :
xlsx = Roo::Spreadsheet.open('Demo.xls') values_under_headers = values_of("Location")
Something same which gives values from 1007,1008,1009.....
HTML code for what?
This is an excel sheet and I want to extract the table values based on the header.
For Example :
xlsx = Roo::Spreadsheet.open('Demo.xls')
values_under_headers = values_of("Location")
Something same which gives values from 1007,1008,1009.....

Laravel livewire, displaying the result of two queries in one grid component

I need to display two datasets coming from the same MySQL database table inside a Laravel Livewire grid component. One dataset contains all the entries from the last 20 minutes and one dataset contains all the entries for the last 24 hours.
For grid component I am looking at https://github.com/mediconesystems/livewire-datatables
The table has the following structure:
ID: Integer
inserted_on: datetime
origination: string
field_count: integer
What would be the best way to achieve this in Laravel with Livewire?

How to extract "last updated" date from this URL to google sheets

I have tried this, but I get three dots
=IMPORTXML("https://covid19.sabah.digital/covid19/","//span[#class='number-last_updated']")
When I saw the HTML data, it seems that the last updated date is displayed by Javascript. By this, unfortunately, the value cannot be directly retrieved with IMPORTXML. This has already been mentioned in the comments.
When I saw the HTML data again, I noticed that the information of date is included in https://data.covid19.sabah.digital/global.json. From this data, how about retrieving the last updated date? In this answer, as a workaround, in order to retrieve the last updated value, I would like to propose to retrieve the data using the following sample formula.
Sample formula:
=TEXT(MAX(ARRAYFORMULA(DATEVALUE(REGEXEXTRACT(QUERY(IMPORTDATA(A1),"SELECT Col1 WHERE Col1 contains 'date'"),"\d{4}-\d{1,2}-\d{1,2}"))))+1,"yyyy-MM-dd")
In this formula, please put the URL of https://data.covid19.sabah.digital/global.json to the cell "A1".
The flow of this formula is as follows.
Retrieve the JSON data using IMPORTDATA.
Retrieve the data values from the retrieved data using QUERY.
Convert the text to the serial number using DATEVALUE.
Retrieve the max value using MAX.
It seems that when this value is added by 1, it is the updated date.
If you don't need this, please remove +1 from the formula.
Convert the serial number to the text using TEXT.
Result:
References:
IMPORTDATA
QUERY
DATEVALUE
MAX
TEXT

datatables + adding a filter per column

How do I get the search/filter to work per column?
I am making small steps in building, and constantly adding to my data table, which is pretty dynamic at this stage. It basically builds a datatable based on the dat that is fed into it. I have now added the footer to act as a search/filter, but unfortunately this is where I have become stuck. I cannot get the filer part to work. Advice greatly appreciated.
here is my sample data tables that I am working on http://live.datatables.net/qociwesi/2/edit
It basically has dTableControl object that builds by table.
To build my table I need to call loadDataFromSocket which does the following:
//then I have this function for loading my data and creating my tables
//file is an array of objects
//formatFunc is a function that formats the data in the data table, and is stored in options for passing to the dTableControl for formatting the datatable - not using this in this example
//ch gets the keys from file[0] which will be the channel headers
//then I add the headers
//then I add the footers
//then I create the table
//then i build the rows using the correct values from file
//then I draw and this then draws all the row that were built
//now the tricky part of applying the search to each columns
So i have got this far but the search per column is not working. How do I get the search/filter to wrok per column?
Note this is a very basic working example that I have been working off: http://jsfiddle.net/HattrickNZ/t12w3a65/
You should use t1.oTable to access DataTables API, see updated example for demonstration.
Please compare your code with jsFiddle in your question, notice its simplicity and consider rewriting your code.

Resources