Closed benjivm closed 1 year ago
@gmask Can you Log the $value and output here
What I don't get is why that mutator is even a concern of the indexer, since a mutator is only used on update of a new record?
Here is a tinker instance of the first record:
>>> $report = App\Models\Report::first();
=> App\Models\Report {#982
id: 1,
author_id: 3,
customer_id: "555",
job_number: 123456,
contact_name: "Foo Bar",
contact_phone: "555-123-4567",
start_date: "2017-11-06",
end_date: "2017-11-10",
active: 1,
created_at: "2017-11-07 06:36:06",
updated_at: "2017-12-12 10:08:21",
}
>>> var_dump($report->created_at);
object(Illuminate\Support\Carbon)#975 (3) {
["date"]=>
string(26) "2017-11-07 06:36:06.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(19) "America/Los_Angeles"
}
And here's how these records are created, $value
is start_date
and end_date
before being converted to a Carbon timestamp.
>>> $report = new App\Models\Report;
=> App\Models\Report {#981}
>>> $report->start_date = "12/13/2017";
=> "12/13/2017"
>>> $report->start_date;
=> Illuminate\Support\Carbon @1513184688 {#975
date: 2017-12-13 09:04:48.0 America/Los_Angeles (-08:00),
}
>>>
Hi, my model has two MySQL
date
columns,start_date
andend_date
stored as "Y-m-d", in addition to Laravel'screated_at
andupdated_at
.In order for me to get them to display on the front end I need this line in my model:
I'm trying to integrate Laravel Scout with this driver but am running into an issue during index:
Likewise, when trying to search the model I get this:
The source of the problem seems to be these setters:
Which I use because the date picker data is flashed in the format
m/d/Y
and then converted on persistence.How can I get around this?