So I have an SQL statement as such; How do I change this to an eloquent query? Or is it better to just use a db:raw query? All inputs are very much appreciated. Cheers! Answer You can try this : Read more at whereBetween section in here
Tag: laravel
Laravel SQL Query. Help me
I have a table name “Offers” with 3 (public, request, private ) types of data. Now I want to show directly to the user end public and request offers. and private offers not be shown but when admin …
Laravel skip results if they are found in previous query
I’m querying my DB twice to get some items into the header of the page and some bellow the header. I want to avoid duplicates in these two queries, currently I do this by adding a skip method to …
How to make this type of query in Laravel?
This is the sql query but how can I do it in laravel? SELECT id FROM clientes where email is null and phone is null and id in(SELECT DISTINCT(cliente_id) FROM reservas WHERE dia < now()) This is …
ELOQUENT – Calculating difference of datetimes in where-clause
I am trying to check if the difference of two columns in my database is under a given amount of years – meaning DATETIME – BIRTHDATE where(date_diff((strtotime(‘…
Why is this not saving to the database?
I’m trying to save a new product into the database, this product has exportation factors which i’m also trying to save, why is this not working? if ($request->has(‘export_factors’)) { $…
Laravel save a input with extra value data
i am trying to save a input value from a time data: On mi example i am saving the data 3:30 for a calendar form, but to use on the calendar i need save …
Math calculation laravel (netto-brutto)
I have code: But I have also another field Rechnung preis – Netto. What must be the code for calculate netto-brutto from bedrag_rechnung_brutto. It must be -19%. Netto = brutto /1,19. Answer What is your question over here? You already answered it yourself?
Posting Coordinates to Database from Google Maps API
Edit: I solved the problem. Leaving it up in case someone needs something similar in the future. I am trying to use google map api to get coordinates and save the information in a database. If the …
How can this be witten in Laravel Eloquent term?
I am converting a piece of database SQL query to Laravel Eloquent query but it doesn’t work. My code snippet looks like this: Can someone explain why? Answer So assuming you have a Post model, you can try something like this: