All Questions
80 questions
0
votes
2
answers
60
views
How to query from mutiple tables and group them by DATE in laravel?
I want to get data from two tables and group them by date, like a daily report that shows data from two tables.
Example output:
Date
Active User
Total Deposit
2023-07-31
10
12500
2023-08-01
5
10000
...
-1
votes
1
answer
222
views
Get a percentage of users from the past 30 days from the current date
I am on laravel mysql and I want a percentage and number of how many new users have been created or left in the past 30 days.
For example, if there are 3 users before 30 days and 2 new users have been ...
0
votes
2
answers
31
views
query all models that are not between two dates
I have a car model and an order model, i need a query that will filter the list of cars that are not rented between two dates, i'm lacking the logic to get the answer right what i came up with is this ...
-2
votes
1
answer
90
views
In my laravel app date is saving at mysql in '0000-00-00' format
I have to take a date range and saved into database every separate date into that range. But the date is saving like '0000-00-00' format although date is passing correctly at controller.
code my ...
0
votes
1
answer
150
views
Laravel query - grouping results in a range of dates
I have a table from which I'd like to pull a list of object_id that satisfy condition:
extended_data starts with "Text1" or "Text2",
time difference between records in table ...
1
vote
1
answer
403
views
How can I save 2021-04-08T22:25:09.335541Z as timestamp to database in Laravel?
I have a date string but this date's format looks like 2021-04-08T22:25:09.335541Z I couldn't saved to database
This is error message
Illuminate\Database\QueryException: SQLSTATE[22007]: Invalid ...
1
vote
2
answers
675
views
How to convert timestamp to Persian at Laravel Migration
I have this GET table and as you can see at the end of it, I have added members.created_at to return the date that user is registered on the website:
class CreateRegisteredStudentInfoView extends ...
0
votes
2
answers
682
views
How to search between two dates in laravel vue
i have a form that has search for some data
i am able to make a search for normal fields
but i am having trouble getting date range
controller:
public function index() {
$query = Matter::query();
$...
2
votes
1
answer
91
views
Laravel eloquent group eloquent records in hourinterval with Left join
I'm using laravel v8 and i have two tables with structure like this:
orders
id
total
created_at
1
100
2022-01-01 11:00:05
2
300
2022-01-01 15:00:05
..
..
...
order_items
id
order_id
product_id
...
1
vote
2
answers
370
views
Storing dates with zeroes (Invalid datetime format)
I read in the MySQL docs that I can store birthdates with 00 if I don't know the month or day, which is exactly what I need, but is this only valid for an old MySQL version or with some option turned ...
0
votes
1
answer
42
views
Check in between dates - Laravel SQL
I find myself writing here, I can't figure out how I can accomplish the following query.
I have a booking table which is formed like this:
id - arrival_date - departure_date - nroom
1 - '2021-10-10' - ...
0
votes
2
answers
77
views
Date between two values - Lavarel SQL
I have a structure table like this : Start_date End_date
Now with today's date, I should go and get all the data including from Start_Date and End_Date, what can I do?
I tried with
SELECT *
FROM ...
0
votes
2
answers
2k
views
How to get monthly reports in laravel and even if no record
I have to make a report for a table in MySQL using Laravel. I have an incomes table like
ID amount created_at
1 200 2020-09-30
2 900 2021-03-10
So if I fill start_date and end_date to fillter ...
0
votes
1
answer
155
views
Laravel Date Query
I have one table vehicles_unavailabilities with following structure:
The from_date and to_date are the dates that the vehicle has been booked and shouldn't show in the search result for the given ...
0
votes
2
answers
1k
views
Changing format of column to datetime MySql
I've got a problem, some donkey in my company create a database with MySql, we got a column for the date and he set it as a varchar.
We cant build an other database because the it's at least here ...
1
vote
2
answers
869
views
How to get birthdate in Laravel?
I want to show the value of first_name and birth_date
of customers who were birthday today. What kind of queries should I do?
$birthday = DB::table('customers')
->select(DB::raw('customers....
2
votes
1
answer
144
views
get all record between two dates interval in mysql
get all record between two dates interval in mysql
I have a user and resource_bookings tables in redmine. I want to get record of users who works 8 hours, less than 8 hours,
0 hours and more than 8 ...
1
vote
2
answers
241
views
Get second highest date from related table
I am trying to fetch the second highest date from a relation-table in with Eloquent Laravel 6.
MoodTable
id animal_id date mood
1 1 2019-12-14 happy
2 1 2019-...
-1
votes
2
answers
816
views
Invalid datetime format: 1292 When using old dates
I have people table and in this I have a field named birthday as timestamp.
When i insert date data like: 2017-05-19 its ok and no errors but when i want to insert some old dates like 1959-08-12 its ...
0
votes
2
answers
1k
views
29 Feb date query. Add one day to the date where condition in SQL statement if specific date is invalid
I have a problem with dates of 29 Feb.
I have a query that receives the year as dynamic parameter from PHP/Laravel. The month and day are not inserted. The query that is sent to the database includes ...
2
votes
0
answers
400
views
"Trailing data" error when trying to update a record with updateOrCreate method
Laravel automatically sets the updated_at and created_at columns fine when I first create a record, but when I go to update the record it gives me a "trailing data" error which I guess has something ...
0
votes
1
answer
7k
views
Save date to MySQL format by using Laravel Carbon
Trying to convert JQuery Datepicker date format 'dd-mm-yy' to MySQL date format 'YYYY-MM-DD' before saving to database using Carbon.
I have tried using Carbon in store method before inserting data ...
1
vote
0
answers
61
views
Fixing wrong dates in Laravel/MySQL
I've realized my application is writing dates the day before they are indicated (For example, when inserting dates within a spreadsheet file import). I set the local timezone once and now all dates ...
1
vote
2
answers
909
views
PHP year 2038 problem with 64bit MySQL can't insert date through PHPMyAdmin
I have a MySQL table which has a column called "created_at" which is a TIMESTAMP field. Whenever I try to insert datetime bigger than 2037 I get the following error:
#1292 - Incorrect datetime value: ...
0
votes
1
answer
79
views
Laravel query fails but works in Mysql
I am new to Laravel and using the following query,
DB::table("rates as rate")
->select("rate.category")
->where(DB::Raw("STR_TO_DATE(CONCAT( start_day, '/', ...
-1
votes
3
answers
398
views
Comparing a database date field with date
Compare database date with a date
I want to check the database date field is less than 5 days or not
I tried with Carbon class which output values in integer and MySQL database returns value in ...
0
votes
1
answer
540
views
Laravel NULL dates are valid "today" dates
In my Laravel 5.8 app, I have a model containing to dates: resubmission and deadline. Both are nullable (in the migration and thus in the current SQL database) and are set to $dates = ['resubmission', ...
1
vote
1
answer
1k
views
timestamp in laravel won't update
I have a column in my table Blis called "deadline". The type is timestamp. I am using MySQL db.
When I save a date in the format "yy-mm-dd h:i:s" it saves fine, but whenever I try to update it to ...
2
votes
2
answers
1k
views
How to store my datetime as a date in my database [duplicate]
Goal: I want to save some data from an api to my database, the date looks like this in the api:
"utcDate": "2018-10-28T13:30:00Z"
I tried using datetime in my migrations but I'm getting errors that ...
0
votes
1
answer
361
views
Laravel Eloquent WhereBetween with Comma Delimited Timestamps?
Given the image above... using Laravel's Eloquent - how could I lookup a specific date range to return the rows that are within that range?
I know Laravel has a whereBetween function that works with ...
3
votes
1
answer
2k
views
How to display timestamp format in edit form in laravel?
I am trying to write update function in laravel, and I am trying to get the old value in edit form, the text fields are easy to retrive back in the form, and also date fields is also working, but for ...
0
votes
1
answer
41
views
Laravel write a query to find if access was enabled on date
I have a table called system_access. A user can have an access, but it has to be enabled. Accesses can be enabled and then disabled later and then enabled and disabled again for infinite number of ...
0
votes
0
answers
79
views
How to work with input dates in a MySql / Laravel (5.6) / AngularJs application?
In my application, a user can specify a date in a form, via a datepicker. Doing so, the date has this format : "2018-05-16T12:45:30Z".
Then, I want to store it in a MySql database, in a TIMESTAMP ...
1
vote
4
answers
4k
views
Laravel order by date, null-dates always at the end
I have to sort orders on my date field send_date, but NULL send_dates always on the end.
I have tried this, but this isn't working:
Order::orderBy(\DB::raw('ISNULL(send_date), send_date'), 'asc')
-&...
0
votes
1
answer
57
views
MySQL get records between / over above two date variables
I've got a MySQL question. I use Laravel in the examples below, but my question is rather MySQL related.
Assume I have an appointments table. An appointment can be of any duration.
So I have 2 ...
0
votes
3
answers
3k
views
Insert DOB in mysql from laravel
i have made a form with three different input fields i.e day, month and year and i need to insert it into database in 'dob' column in the type 'date'. how can i insert them all with date format in one ...
1
vote
3
answers
2k
views
How to display date selected from blade to blade?
I have a form in my blade with 2 dates for user to select like:
<form role="form" action="{{action('AltHr\Chatbot\PreBuiltController@viewgraphByDate', [$companyID])}}" autocomplete="off" method="...
1
vote
3
answers
2k
views
Insert a date with format of mysql date as yyyy-mm-dd in laravel
I am using Laravel eloquent and I have a model with two date fields with date type in mysql. My date value is dd/mm/yyyy. How can I insert a date with format of mysql date as yyyy-mm-dd.
My model
...
0
votes
1
answer
4k
views
Generate unique user id in PHP
I am developing an app using Laravel which will have a functionality to register user.
I want to provide customized unique id to every user (ie: User_id = SM129).
Userid will have following features:
...
0
votes
2
answers
2k
views
Date from API call not being accepted in Laravel as a dateTime field
I am getting dates from an API call. The date is formatted in this way
2017-10-19T15:30:00
I want to store this date in my MYSQL database using Laravel Database Migration, currently I am using
$...
1
vote
1
answer
1k
views
How to view data based on date range using laravel and mysql
Route:
Route::post('dategraph','Chatbot\TrackerController@dategraph');
Controller:
public function dategraph(Request $request)
{
$dategraph = DiraStatistics::all()->whereBetween('date_access'...
0
votes
0
answers
2k
views
Laravel Eloquent search by Date Range
I have two table "patient" and "booking" table, and there is a relationship "One to Many" between them, I made a search form in an index_booking page where a user can type a patient_name on it to ...
0
votes
1
answer
464
views
Getting rows from a range of dates in laravel
I am trying to fetch rows from database by applying a range of two dates. starting and ending
This below is a test data.
Collection {#258 ▼
#items: array:4 [▼
0 => Customer_history {#237 ▶}
...
-1
votes
1
answer
57
views
PHP - Best way to query database or collection by date and do sub calculations
I have a collection/db of around 4k elements and each have a datetime and value e.g :
DATE Value
2017-01-01 17:00 994.44
2017-01-01 18:00 998.56
2017-01-01 19:00 1231
2017-...
1
vote
1
answer
495
views
Pull & Format date direct from Eloquent query
Im trying to pull a load of results from a MySQL database and format the date string within the same query. My dates in the database are stored as yyyy-mm-dd but im being asked to pull them as dd-mm-...
0
votes
1
answer
3k
views
Laravel Eloquent date range between range
I am building a website where i have a booking mechanism.
The user can book a hotel room for X days if the room is available.
I am using:
Laravel 5.4
MySql
The room is unavailable if:
It is ...
1
vote
2
answers
2k
views
Laravel 5.2 compare dates that are strings?
I have a table that contains two dates: start_date and end_date. Both of these columns are string. When I try to query to get the records comparing against these dates, Laravel treats them as strings, ...
3
votes
3
answers
2k
views
Laravel show different date from my database
I have a problem in my project. When I store value in my database it works perfectly fine. But when I want to show the value it gives me an undefined date that is not stored in my database.
Here In ...
1
vote
1
answer
578
views
avoid time/date overlapping in mysql (laravel)
I have an iOS app where users can reserve a car either daily or hourly and if a user reserves one car other user can't reserve it till the first reservation is over. I'm using Laravel as the API to ...
0
votes
3
answers
1k
views
Show and store different date formats on AngularJS Directive
I have a directive that I use to display a datepicker on date inputs. It works well when I use this date format:
yy-mm-dd
(I store that date on MySQL). The problem is that I need to display the ...